Module: Avataree::Helper

Included in:
ImageServices, ProfileServices
Defined in:
lib/avataree/helper.rb

Defined Under Namespace

Modules: MonkeyPatches

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Attribute Details

+ (Object) secure_url_services

Returns the value of attribute secure_url_services



30
31
32
# File 'lib/avataree/helper.rb', line 30

def secure_url_services
  @secure_url_services
end

+ (Object) url_services

Returns the value of attribute url_services



30
31
32
# File 'lib/avataree/helper.rb', line 30

def url_services
  @url_services
end

Class Method Details

+ (Object) included(base)



33
34
35
36
37
# File 'lib/avataree/helper.rb', line 33

def self.included(base)
  self.secure_url_services  = "https://secure.gravatar.com/"
  self.url_services         = "http://www.gravatar.com/"
  MonkeyPatches.activate!
end

+ (Object) url_for_request(ssl = false)



44
45
46
# File 'lib/avataree/helper.rb', line 44

def self.url_for_request(ssl = false)
  ssl ? self.secure_url_services : self.url_services
end

Instance Method Details

- (Object) get_params(options)



52
53
54
# File 'lib/avataree/helper.rb', line 52

def get_params(options)
  options.to_param.presence
end

- (Object) make_digest(email)

makes MD5 hash of given email



40
41
42
# File 'lib/avataree/helper.rb', line 40

def make_digest(email)
  Digest::MD5.hexdigest(email)
end

- (Object) prepare_url_with_params(url, options)



48
49
50
# File 'lib/avataree/helper.rb', line 48

def prepare_url_with_params(url, options)
  [url, get_params(options)].compact.join("?")
end