class PatientZero::Organization
Attributes
avatar[RW]
id[RW]
name[RW]
Public Class Methods
all()
click to toggle source
# 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
new(attributes)
click to toggle source
# File lib/patient_zero/organization.rb, line 6 def initialize attributes @id = attributes.fetch 'id' @name = attributes.fetch 'name' @avatar = attributes.fetch 'avatar' end
Public Instance Methods
sources()
click to toggle source
# File lib/patient_zero/organization.rb, line 19 def sources Source.all token end
token()
click to toggle source
# 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