Class: Coach4rb::Resource::User
- Inherits:
-
Entity
- Object
- Entity
- Coach4rb::Resource::User
- Defined in:
- lib/coach4rb/resource/user.rb
Instance Attribute Summary (collapse)
-
- (Object) datecreated
(also: #created)
Returns the value of attribute datecreated.
-
- (Object) email
Returns the value of attribute email.
-
- (Object) partnerships
Returns the value of attribute partnerships.
-
- (Object) password
Returns the value of attribute password.
-
- (Object) publicvisible
(also: #public_visible)
Returns the value of attribute publicvisible.
-
- (Object) realname
(also: #real_name)
Returns the value of attribute realname.
-
- (Object) subscriptions
Returns the value of attribute subscriptions.
-
- (Object) username
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
- (Object) datecreated 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 |
- (Object) email
Returns the value of attribute email
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def email @email end |
- (Object) partnerships
Returns the value of attribute partnerships
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def partnerships @partnerships end |
- (Object) password
Returns the value of attribute password
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def password @password end |
- (Object) publicvisible 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 |
- (Object) realname 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 |
- (Object) subscriptions
Returns the value of attribute subscriptions
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def subscriptions @subscriptions end |
- (Object) username
Returns the value of attribute username
7 8 9 |
# File 'lib/coach4rb/resource/user.rb', line 7 def username @username end |
Class Method Details
+ (Object) from_coach(a_hash)
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
- (Object) entity_path
28 29 30 |
# File 'lib/coach4rb/resource/user.rb', line 28 def entity_path "/users/#{username}" end |