Class: PatientZero::Organization
- Inherits:
-
Object
- Object
- PatientZero::Organization
- Includes:
- Client
- Defined in:
- lib/patient_zero/organization.rb
Instance Attribute Summary collapse
-
#avatar ⇒ Object
Returns the value of attribute avatar.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Organization
constructor
A new instance of Organization.
- #sources ⇒ Object
- #token ⇒ Object
Methods included from Client
#connection, #get, included, #parse, #post, #put
Constructor Details
#initialize(attributes) ⇒ Organization
Returns a new instance of Organization.
6 7 8 9 10 |
# File 'lib/patient_zero/organization.rb', line 6 def initialize attributes @id = attributes.fetch 'id' @name = attributes.fetch 'name' @avatar = attributes.fetch 'avatar' end |
Instance Attribute Details
#avatar ⇒ Object
Returns the value of attribute avatar.
4 5 6 |
# File 'lib/patient_zero/organization.rb', line 4 def avatar @avatar end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/patient_zero/organization.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/patient_zero/organization.rb', line 4 def name @name end |
Class Method Details
.all ⇒ Object
12 13 14 15 16 17 |
# File 'lib/patient_zero/organization.rb', line 12 def self.all response = get '/mobile/api/v1/organizations', client_token: Authorization.token response['organizations'].map do |organization_attributes| new organization_attributes end end |
Instance Method Details
#sources ⇒ Object
19 20 21 |
# File 'lib/patient_zero/organization.rb', line 19 def sources Source.all token end |
#token ⇒ Object
23 24 25 26 |
# File 'lib/patient_zero/organization.rb', line 23 def token response = get "/mobile/api/v1/organizations/#{id}/switch", client_token: Authorization.token response['user_token'] end |