Class: Gonebusy::EntitiesServiceResponse
- Defined in:
- lib/gonebusy/models/entities_service_response.rb
Instance Attribute Summary collapse
-
#categories ⇒ List of Integer
array of Category ids Service belongs to.
-
#description ⇒ String
description of Service.
-
#duration ⇒ Integer
length of Service in minutes.
-
#id ⇒ Integer
id of Service.
-
#is_active ⇒ Boolean
status of Service.
-
#max_duration ⇒ Integer
max length of Service in minutes.
-
#name ⇒ String
name of Service.
-
#owner_id ⇒ Integer
id of owner of Service.
-
#price_model_id ⇒ Integer
id of Pricing Model.
-
#resources ⇒ List of Integer
array of Resource ids offering Service.
-
#schedules ⇒ List of Integer
array of Schedule ids, one for each Resource offering Service.
-
#short_name ⇒ String
abbreviated name for Service.
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(id = nil, owner_id = nil, name = nil, short_name = nil, duration = nil, max_duration = nil, description = nil, price_model_id = nil, is_active = nil, categories = nil, resources = nil, schedules = nil) ⇒ EntitiesServiceResponse
constructor
A new instance of EntitiesServiceResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(id = nil, owner_id = nil, name = nil, short_name = nil, duration = nil, max_duration = nil, description = nil, price_model_id = nil, is_active = nil, categories = nil, resources = nil, schedules = nil) ⇒ EntitiesServiceResponse
Returns a new instance of EntitiesServiceResponse.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 73 def initialize(id = nil, owner_id = nil, name = nil, short_name = nil, duration = nil, max_duration = nil, description = nil, price_model_id = nil, is_active = nil, categories = nil, resources = nil, schedules = nil) @id = id @owner_id = owner_id @name = name @short_name = short_name @duration = duration @max_duration = max_duration @description = description @price_model_id = price_model_id @is_active = is_active @categories = categories @resources = resources @schedules = schedules end |
Instance Attribute Details
#categories ⇒ List of Integer
array of Category ids Service belongs to
43 44 45 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 43 def categories @categories end |
#description ⇒ String
description of Service
31 32 33 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 31 def description @description end |
#duration ⇒ Integer
length of Service in minutes
23 24 25 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 23 def duration @duration end |
#id ⇒ Integer
id of Service
7 8 9 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 7 def id @id end |
#is_active ⇒ Boolean
status of Service
39 40 41 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 39 def is_active @is_active end |
#max_duration ⇒ Integer
max length of Service in minutes
27 28 29 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 27 def max_duration @max_duration end |
#name ⇒ String
name of Service
15 16 17 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 15 def name @name end |
#owner_id ⇒ Integer
id of owner of Service
11 12 13 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 11 def owner_id @owner_id end |
#price_model_id ⇒ Integer
id of Pricing Model
35 36 37 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 35 def price_model_id @price_model_id end |
#resources ⇒ List of Integer
array of Resource ids offering Service
47 48 49 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 47 def resources @resources end |
#schedules ⇒ List of Integer
array of Schedule ids, one for each Resource offering Service
51 52 53 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 51 def schedules @schedules end |
#short_name ⇒ String
abbreviated name for Service
19 20 21 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 19 def short_name @short_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 100 def self.from_hash(hash) return nil unless hash # Extract variables from the hash id = hash['id'] owner_id = hash['owner_id'] name = hash['name'] short_name = hash['short_name'] duration = hash['duration'] max_duration = hash['max_duration'] description = hash['description'] price_model_id = hash['price_model_id'] is_active = hash['is_active'] categories = hash['categories'] resources = hash['resources'] schedules = hash['schedules'] # Create object from extracted values EntitiesServiceResponse.new(id, owner_id, name, short_name, duration, max_duration, description, price_model_id, is_active, categories, resources, schedules) end |
.names ⇒ Object
A mapping from model property names to API property names
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/gonebusy/models/entities_service_response.rb', line 54 def self.names if @_hash.nil? @_hash = {} @_hash["id"] = "id" @_hash["owner_id"] = "owner_id" @_hash["name"] = "name" @_hash["short_name"] = "short_name" @_hash["duration"] = "duration" @_hash["max_duration"] = "max_duration" @_hash["description"] = "description" @_hash["price_model_id"] = "price_model_id" @_hash["is_active"] = "is_active" @_hash["categories"] = "categories" @_hash["resources"] = "resources" @_hash["schedules"] = "schedules" end @_hash end |