Class: Gonebusy::EntitiesSearchResponse
- Defined in:
- lib/gonebusy/models/entities_search_response.rb
Instance Attribute Summary collapse
-
#services ⇒ List of EntitiesServiceResponse
array of Services matching query.
-
#users ⇒ List of EntitiesUserResponse
array of Users matching query.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(users = nil, services = nil) ⇒ EntitiesSearchResponse
constructor
A new instance of EntitiesSearchResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(users = nil, services = nil) ⇒ EntitiesSearchResponse
Returns a new instance of EntitiesSearchResponse.
23 24 25 26 27 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 23 def initialize(users = nil, services = nil) @users = users @services = services end |
Instance Attribute Details
#services ⇒ List of EntitiesServiceResponse
array of Services matching query
11 12 13 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 11 def services @services end |
#users ⇒ List of EntitiesUserResponse
array of Users matching query
7 8 9 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 7 def users @users end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 30 def self.from_hash(hash) return nil unless hash # Extract variables from the hash # Parameter is an array, so we need to iterate through it users = nil if hash['users'] != nil users = Array.new hash['users'].each{|structure| users << (EntitiesUserResponse.from_hash(structure) if structure)} end # Parameter is an array, so we need to iterate through it services = nil if hash['services'] != nil services = Array.new hash['services'].each{|structure| services << (EntitiesServiceResponse.from_hash(structure) if structure)} end # Create object from extracted values EntitiesSearchResponse.new(users, services) end |
.names ⇒ Object
A mapping from model property names to API property names
14 15 16 17 18 19 20 21 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 14 def self.names if @_hash.nil? @_hash = {} @_hash["users"] = "users" @_hash["services"] = "services" end @_hash end |