Class: EventBright::User

Inherits:
ApiObject show all
Defined in:
lib/eventbright/api_objects/user.rb

Instance Attribute Summary

Attributes inherited from ApiObject

#attributes, #collections, #dirty, #dirty_collections, #dirty_relations, #id, #relations

Instance Method Summary collapse

Methods inherited from ApiObject

#after_attribute_set, #after_load, #after_new, #after_save, #after_update, #api_hash, #attribute_get, #attribute_set, #before_save, #clean!, #dirty?, #get_hash, #init, #init_with_hash, #inspect, #load, #load!, #loaded?, #nested_hash, #new_hash, #preinit, #save, #to_s, #updatable_hash, #update_hash

Methods included from ApiObjectClassMethods

#collection, #collections, #has, #ignores, #plural_name, #readable, #readable_date, #reformats, #relations, #remap, #renames, #requires, #singlet_name, #updatable, #updatable_date

Methods included from ApiObjectRelationships

#collection_clean!, #collection_dirty!, #collection_dirty?, #collection_get, #collection_set, #collections_save, #load_collections_with_hash, #load_relations_with_hash, #relation_clean!, #relation_dirty!, #relation_dirty?, #relation_get, #relation_set, #relations_save

Constructor Details

#initialize(user, no_load = false) ⇒ User

Returns a new instance of User


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eventbright/api_objects/user.rb', line 15

def initialize(user, no_load = false)
  preinit
  case user
  when Array
    email, password = user
    attribute_set(:email, email, true)
    attribute_set(:password, password, true)
  else
    attribute_set(:user_key, user, true)
  end
  load! unless no_load
end

Instance Method Details

#authObject


40
41
42
# File 'lib/eventbright/api_objects/user.rb', line 40

def auth
  attribute_get(:user_key) ? {'user_key' => attribute_get(:user_key)} : {'user' => attribute_get(:email), 'password' => attribute_get(:password)} 
end

#ownerObject


36
37
38
# File 'lib/eventbright/api_objects/user.rb', line 36

def owner
  self
end

#prep_api_hash(method = 'get', hash = {}) ⇒ Object


28
29
30
# File 'lib/eventbright/api_objects/user.rb', line 28

def prep_api_hash(method = 'get', hash = {})
  {:user => self}
end

#unnest_child_response(response) ⇒ Object


32
33
34
# File 'lib/eventbright/api_objects/user.rb', line 32

def unnest_child_response(response)
  response
end