Class: Plangrade::Resources::User
- Defined in:
- lib/plangrade/resources/user.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#api_handler, #base_name, base_name, #changes, #delete!, fetch, get, identity_map, #initialize, #load!, #loaded?, model_attributes, #modified?, #new_record?, #persisted?, #reload!, #save
Methods included from ApiHandler
#api_handler, #establish_api_handler
Constructor Details
This class inherits a constructor from Plangrade::Resources::Base
Class Method Details
.create(email, name) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/plangrade/resources/user.rb', line 11 def self.create(email, name) result = api_handler.create_user(:email => email, :name => name) return nil unless result.created? id = result.headers[:location].split('/').last.to_i new(:id => id) end |
.current ⇒ Object
5 6 7 8 9 |
# File 'lib/plangrade/resources/user.rb', line 5 def self.current result = api_handler.current_resource_owner return nil unless result.success? new(result.body) end |
Instance Method Details
#update!(params) ⇒ Object
20 21 22 |
# File 'lib/plangrade/resources/user.rb', line 20 def update!(params) api_handler.update_user(@id, params) end |