Sha256: d72706e0baf7af94d009ddf621dcc4b2cc62e41bf544acaa4805429af54a9577

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

module Rails
  module MoshimoshiRailsHelper
    module Helper
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moshimoshi-rails-helper-0.0.1 lib/moshimoshi-rails-helper/helper.rb