Class: Coach4rb::Resource::User
- Defined in:
- lib/coach4rb/resource/user.rb
Instance Attribute Summary collapse
-
#datecreated ⇒ Object
(also: #created)
Returns the value of attribute datecreated.
-
#email ⇒ Object
Returns the value of attribute email.
-
#partnerships ⇒ Object
Returns the value of attribute partnerships.
-
#password ⇒ Object
Returns the value of attribute password.
-
#publicvisible ⇒ Object
(also: #public_visible)
Returns the value of attribute publicvisible.
-
#realname ⇒ Object
(also: #real_name)
Returns the value of attribute realname.
-
#subscriptions ⇒ Object
Returns the value of attribute subscriptions.
-
#username ⇒ Object
Returns the value of attribute username.
Attributes inherited from Entity
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Entity
Methods included from Mixin::AsHash
Methods included from Mixin::Iterable
Methods included from Mixin::AutoConstructor
Instance Attribute Details
#datecreated ⇒ Object Also known as: created
Returns the value of attribute datecreated.
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def datecreated @datecreated end |
#email ⇒ Object
Returns the value of attribute email.
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def email @email end |
#partnerships ⇒ Object
Returns the value of attribute partnerships.
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def partnerships @partnerships end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def password @password end |
#publicvisible ⇒ Object Also known as: public_visible
Returns the value of attribute publicvisible.
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def publicvisible @publicvisible end |
#realname ⇒ Object Also known as: real_name
Returns the value of attribute realname.
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def realname @realname end |
#subscriptions ⇒ Object
Returns the value of attribute subscriptions.
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def subscriptions @subscriptions end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def username @username end |
Class Method Details
.from_coach(a_hash) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/coach4rb/resource/user.rb', line 16 def self.from_coach(a_hash) new_hash = a_hash.dup new_hash[:password] = nil # avoid having a star password new_hash[:partnerships] ||= [] new_hash[:partnerships] = new_hash[:partnerships].map {|a_hash| Resource::Partnership.from_coach a_hash } new_hash[:subscriptions] ||= [] new_hash[:subscriptions] = new_hash[:subscriptions].map {|a_hash| Resource::Subscription.from_coach a_hash } new_hash[:datecreated] = Time.at(new_hash[:datecreated]/1000).to_datetime rescue nil super(new_hash) end |
Instance Method Details
#entity_path ⇒ Object
28 29 30 |
# File 'lib/coach4rb/resource/user.rb', line 28 def entity_path "/users/#{username}" end |