Class: MyEmma
- Inherits:
-
Object
- Object
- MyEmma
- Includes:
- HTTParty
- Defined in:
- lib/my_emma.rb,
lib/my_emma/response.rb
Defined Under Namespace
Constant Summary collapse
- REQUIRED_CREDENTIALS =
[ 'emma_account_id', 'signup_post', 'username', 'password', ].sort.freeze
Class Method Summary collapse
Class Method Details
.credentials ⇒ Object
36 37 38 |
# File 'lib/my_emma.rb', line 36 def self.credentials @@credentials ||= {} end |
.credentials=(h = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/my_emma.rb', line 30 def self.credentials=(h={}) h.stringify_keys! raise Error, "Missing required credential(s): #{(REQUIRED_CREDENTIALS - h.keys.sort).inspect}" unless h.keys.sort == REQUIRED_CREDENTIALS @@credentials = h end |
.signup(email, parameters = {}) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/my_emma.rb', line 23 def self.signup(email, parameters={}) if email_valid?(email) parameters.merge! credentials.merge(:emma_member_email => email) Response.new post('/app/view:RemoteSignup', :body => parameters) end end |