Class: G5FoundationClient::Client
- Inherits:
-
Object
- Object
- G5FoundationClient::Client
- Extended by:
- FindableByUid
- Defined in:
- lib/g5_foundation_client/models/client.rb
Instance Attribute Summary collapse
-
#client_hash ⇒ Object
Returns the value of attribute client_hash.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Client
constructor
A new instance of Client.
- #locations ⇒ Object
Methods included from FindableByUid
Constructor Details
#initialize(attrs) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/g5_foundation_client/models/client.rb', line 5 def initialize(attrs) self.client_hash = ActiveSupport::HashWithIndifferentAccess.new attrs.fetch(:client, attrs) end |
Instance Attribute Details
#client_hash ⇒ Object
Returns the value of attribute client_hash.
3 4 5 |
# File 'lib/g5_foundation_client/models/client.rb', line 3 def client_hash @client_hash end |
Class Method Details
.all_client_uids(clients_uri) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/g5_foundation_client/models/client.rb', line 10 def all_client_uids(clients_uri) G5FoundationClient::Fetcher.fetch_url(clients_uri) do |json| hash = ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(json)) hash[:clients].collect { |client| client[:uid] } end end |
Instance Method Details
#locations ⇒ Object
23 24 25 |
# File 'lib/g5_foundation_client/models/client.rb', line 23 def locations @locations ||= self.client_hash[:locations].collect { |lh| G5FoundationClient::Location.new(lh.merge(client: self)) } end |