Class: Coach4rb::Resource::Partnership
- Defined in:
- lib/coach4rb/resource/partnership.rb
Instance Attribute Summary collapse
-
#datecreated ⇒ Object
(also: #created)
Returns the value of attribute datecreated.
-
#id ⇒ Object
Returns the value of attribute id.
-
#links ⇒ Object
Returns the value of attribute links.
-
#publicvisible ⇒ Object
(also: #visible)
Returns the value of attribute publicvisible.
-
#subscriptions ⇒ Object
Returns the value of attribute subscriptions.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#user1 ⇒ Object
(also: #first_user)
Returns the value of attribute user1.
-
#user2 ⇒ Object
(also: #second_user)
Returns the value of attribute user2.
-
#userconfirmed1 ⇒ Object
(also: #first_user_confirmed)
Returns the value of attribute userconfirmed1.
-
#userconfirmed2 ⇒ Object
(also: #second_user_confirmed)
Returns the value of attribute userconfirmed2.
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/partnership.rb', line 7 def datecreated @datecreated end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def id @id end |
#links ⇒ Object
Returns the value of attribute links.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def links @links end |
#publicvisible ⇒ Object Also known as: visible
Returns the value of attribute publicvisible.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def publicvisible @publicvisible end |
#subscriptions ⇒ Object
Returns the value of attribute subscriptions.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def subscriptions @subscriptions end |
#uri ⇒ Object
Returns the value of attribute uri.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def uri @uri end |
#user1 ⇒ Object Also known as: first_user
Returns the value of attribute user1.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def user1 @user1 end |
#user2 ⇒ Object Also known as: second_user
Returns the value of attribute user2.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def user2 @user2 end |
#userconfirmed1 ⇒ Object Also known as: first_user_confirmed
Returns the value of attribute userconfirmed1.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def userconfirmed1 @userconfirmed1 end |
#userconfirmed2 ⇒ Object Also known as: second_user_confirmed
Returns the value of attribute userconfirmed2.
7 8 9 |
# File 'lib/coach4rb/resource/partnership.rb', line 7 def userconfirmed2 @userconfirmed2 end |
Class Method Details
.from_coach(a_hash) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/coach4rb/resource/partnership.rb', line 18 def self.from_coach(a_hash) new_hash = a_hash.dup new_hash[:datecreated] = Time.at(new_hash[:datecreated]/1000).to_datetime rescue nil new_hash[:subscriptions] ||= [] new_hash[:subscriptions] = new_hash[:subscriptions].map {|a_hash| Resource::Subscription.from_coach a_hash } new_hash[:user1] = Resource::User.from_coach(new_hash[:user1]) rescue nil new_hash[:user2] = Resource::User.from_coach(new_hash[:user2]) rescue nil super new_hash end |
Instance Method Details
#entity_path ⇒ Object
29 30 31 |
# File 'lib/coach4rb/resource/partnership.rb', line 29 def entity_path "/partnerships/#{first_user.username};#{second_user.username}" end |