Class: Gonebusy::UpdateServiceByIdBody

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/update_service_by_id_body.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(name = nil, description = nil, duration = nil, max_duration = nil, short_name = nil, price_model_id = nil, resources = nil, categories = nil) ⇒ UpdateServiceByIdBody

Returns a new instance of UpdateServiceByIdBody.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 53

def initialize(name = nil,
               description = nil,
               duration = nil,
               max_duration = nil,
               short_name = nil,
               price_model_id = nil,
               resources = nil,
               categories = nil)
  @name = name
  @description = description
  @duration = duration
  @max_duration = max_duration
  @short_name = short_name
  @price_model_id = price_model_id
  @resources = resources
  @categories = categories
end

Instance Attribute Details

#categoriesString

Optional List of comma-separated Category IDs to associate with Service

Returns:



35
36
37
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 35

def categories
  @categories
end

#descriptionString

Service Description

Returns:



11
12
13
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 11

def description
  @description
end

#durationInteger

Duration in minutes of the Service

Returns:

  • (Integer)


15
16
17
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 15

def duration
  @duration
end

#max_durationInteger

Max duration of the Service in minutes

Returns:

  • (Integer)


19
20
21
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 19

def max_duration
  @max_duration
end

#nameString

Service Name

Returns:



7
8
9
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 7

def name
  @name
end

#price_model_idInteger

Optional Price Model Id

Returns:

  • (Integer)


27
28
29
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 27

def price_model_id
  @price_model_id
end

#resourcesString

Optional List of comma-separated Resource IDs that will provide this Service, default: API user’s resource id

Returns:



31
32
33
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 31

def resources
  @resources
end

#short_nameString

Optional abbreviated Service name

Returns:



23
24
25
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 23

def short_name
  @short_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 72

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']
  short_name = hash['short_name']
  price_model_id = hash['price_model_id']
  resources = hash['resources']
  categories = hash['categories']

  # Create object from extracted values
  UpdateServiceByIdBody.new(name,
                            description,
                            duration,
                            max_duration,
                            short_name,
                            price_model_id,
                            resources,
                            categories)
end

.namesObject

A mapping from model property names to API property names



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gonebusy/models/update_service_by_id_body.rb', line 38

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash["name"] = "name"
    @_hash["description"] = "description"
    @_hash["duration"] = "duration"
    @_hash["max_duration"] = "max_duration"
    @_hash["short_name"] = "short_name"
    @_hash["price_model_id"] = "price_model_id"
    @_hash["resources"] = "resources"
    @_hash["categories"] = "categories"
  end
  @_hash
end