Module: Rails::MoshimoshiRailsHelper::Helper

Defined in:
lib/moshimoshi-rails-helper/helper.rb

Instance Method Summary collapse

Instance Method Details

#moshimoshi_tag(email, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/moshimoshi-rails-helper/helper.rb', line 4

def moshimoshi_tag(email, options = {})
  options[:error] ||= "This user has not yet established a bio at http://moshimoshi.me."

  require 'httparty'
  email_address = email.downcase
  hash = Digest::MD5.hexdigest(email_address)
  response = HTTParty.get("http://moshimoshi.me/api/users/show/#{ hash }")
  unless response.nil?
    return response.body
  else
    return options[:error]
  end
end