Class: Gonebusy::CreateServiceBody
- Defined in:
- lib/gonebusy/models/create_service_body.rb
Instance Attribute Summary collapse
-
#categories ⇒ String
Optional List of comma-separated Category IDs to associate with Service.
-
#description ⇒ String
Service Description.
-
#duration ⇒ Integer
Duration in minutes of the Service.
-
#max_duration ⇒ Integer
Max duration of the Service in minutes.
-
#name ⇒ String
Service Name.
-
#price_model_id ⇒ Integer
Optional Price Model Id.
-
#resources ⇒ String
Optional List of comma-separated Resource IDs that will provide this Service, default: API user’s resource id.
-
#short_name ⇒ String
Optional abbreviated Service name.
-
#user_id ⇒ Integer
ID of User to create Service for.
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(name = nil, description = nil, duration = nil, max_duration = nil, user_id = nil, short_name = nil, price_model_id = nil, resources = nil, categories = nil) ⇒ CreateServiceBody
constructor
A new instance of CreateServiceBody.
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, description = nil, duration = nil, max_duration = nil, user_id = nil, short_name = nil, price_model_id = nil, resources = nil, categories = nil) ⇒ CreateServiceBody
Returns a new instance of CreateServiceBody.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/gonebusy/models/create_service_body.rb', line 58 def initialize(name = nil, description = nil, duration = nil, max_duration = nil, user_id = nil, short_name = nil, price_model_id = nil, resources = nil, categories = nil) @name = name @description = description @duration = duration @max_duration = max_duration @user_id = user_id @short_name = short_name @price_model_id = price_model_id @resources = resources @categories = categories end |
Instance Attribute Details
#categories ⇒ String
Optional List of comma-separated Category IDs to associate with Service
39 40 41 |
# File 'lib/gonebusy/models/create_service_body.rb', line 39 def categories @categories end |
#description ⇒ String
Service Description
11 12 13 |
# File 'lib/gonebusy/models/create_service_body.rb', line 11 def description @description end |
#duration ⇒ Integer
Duration in minutes of the Service
15 16 17 |
# File 'lib/gonebusy/models/create_service_body.rb', line 15 def duration @duration end |
#max_duration ⇒ Integer
Max duration of the Service in minutes
19 20 21 |
# File 'lib/gonebusy/models/create_service_body.rb', line 19 def max_duration @max_duration end |
#name ⇒ String
Service Name
7 8 9 |
# File 'lib/gonebusy/models/create_service_body.rb', line 7 def name @name end |
#price_model_id ⇒ Integer
Optional Price Model Id
31 32 33 |
# File 'lib/gonebusy/models/create_service_body.rb', line 31 def price_model_id @price_model_id end |
#resources ⇒ String
Optional List of comma-separated Resource IDs that will provide this Service, default: API user’s resource id
35 36 37 |
# File 'lib/gonebusy/models/create_service_body.rb', line 35 def resources @resources end |
#short_name ⇒ String
Optional abbreviated Service name
27 28 29 |
# File 'lib/gonebusy/models/create_service_body.rb', line 27 def short_name @short_name end |
#user_id ⇒ Integer
ID of User to create Service for. You must be authorized to manage this User Id.
23 24 25 |
# File 'lib/gonebusy/models/create_service_body.rb', line 23 def user_id @user_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/gonebusy/models/create_service_body.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash name = hash['name'] description = hash['description'] duration = hash['duration'] max_duration = hash['max_duration'] user_id = hash['user_id'] short_name = hash['short_name'] price_model_id = hash['price_model_id'] resources = hash['resources'] categories = hash['categories'] # Create object from extracted values CreateServiceBody.new(name, description, duration, max_duration, user_id, short_name, price_model_id, resources, categories) end |
.names ⇒ Object
A mapping from model property names to API property names
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gonebusy/models/create_service_body.rb', line 42 def self.names if @_hash.nil? @_hash = {} @_hash["name"] = "name" @_hash["description"] = "description" @_hash["duration"] = "duration" @_hash["max_duration"] = "max_duration" @_hash["user_id"] = "user_id" @_hash["short_name"] = "short_name" @_hash["price_model_id"] = "price_model_id" @_hash["resources"] = "resources" @_hash["categories"] = "categories" end @_hash end |