Module: Umeng::Util
- Included in:
- Services
- Defined in:
- lib/umeng/util.rb
Instance Method Summary collapse
- #generate_sign(uri, params) ⇒ Object
-
#result(body, type) ⇒ Object
“total_count”=>0, “accept_count”=>0, “sent_count”=>0, “open_count”=>0, “dismiss_count”=>0.
Instance Method Details
#generate_sign(uri, params) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/umeng/util.rb', line 3 def generate_sign(uri, params) method = 'POST' url = [Umeng::UMENG_HOST, '/', uri] post_body = JSON.dump(params) Digest::MD5.hexdigest([method, url, post_body, @app_master_secret].join) end |
#result(body, type) ⇒ Object
“total_count”=>0, “accept_count”=>0, “sent_count”=>0, “open_count”=>0, “dismiss_count”=>0
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/umeng/util.rb', line 11 def result(body, type) result = JSON.load(body) case type when 'api/send' body when 'api/status' body when 'api/cancel' body end end |