Class: ContextIO::Lite::UserCollection
- Inherits:
-
Object
- Object
- ContextIO::Lite::UserCollection
- Includes:
- API::ResourceCollection
- Defined in:
- lib/contextio/lite/user_collection.rb
Instance Attribute Summary
Attributes included from API::ResourceCollection
#api, #resource_url, #where_constraints
Instance Method Summary collapse
-
#create(options = {}) ⇒ Account
Creates a new email account for your Context.IO account.
Methods included from API::ResourceCollection
#[], #each, #empty?, #initialize, #size, #where
Instance Method Details
#create(options = {}) ⇒ Account
Creates a new email account for your Context.IO account.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/contextio/lite/user_collection.rb', line 20 def create(={}) email = .delete(:email) || .delete('email') || where_constraints[:email] || where_constraints['email'] if email.nil? raise ArgumentError, 'You must provide an email for new Users.' end result_hash = api.request( :post, resource_url, .merge(email: email) ) result_hash.delete('success') resource_class.new(api, result_hash) end |