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

.secure_url_servicesObject

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

.url_servicesObject

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

.included(base) ⇒ Object



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

.url_for_request(ssl = false) ⇒ Object



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

#get_params(options) ⇒ Object



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

def get_params(options)
  options.to_param.presence
end

#make_digest(email) ⇒ Object

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

#prepare_url_with_params(url, options) ⇒ Object



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

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