Class: Gonebusy::EntitiesServiceResponse

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(categories = nil, description = nil, duration = nil, max_duration = nil, id = nil, is_active = nil, name = nil, owner_id = nil, price_model_id = nil, resources = nil, schedules = nil, short_name = nil) ⇒ EntitiesServiceResponse

Returns a new instance of EntitiesServiceResponse.



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

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

Instance Attribute Details

#categoriesList of Integer

array of Category ids Service belongs to

Returns:

  • (List of Integer)


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

def categories
  @categories
end

#descriptionString

description of Service

Returns:



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

def description
  @description
end

#durationInteger

length of Service in minutes

Returns:

  • (Integer)


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

def duration
  @duration
end

#idInteger

id of Service

Returns:

  • (Integer)


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

def id
  @id
end

#is_activeBoolean

status of Service

Returns:

  • (Boolean)


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

def is_active
  @is_active
end

#max_durationInteger

max length of Service in minutes

Returns:

  • (Integer)


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

def max_duration
  @max_duration
end

#nameString

name of Service

Returns:



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

def name
  @name
end

#owner_idInteger

id of owner of Service

Returns:

  • (Integer)


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

def owner_id
  @owner_id
end

#price_model_idInteger

id of Pricing Model

Returns:

  • (Integer)


39
40
41
# File 'lib/gonebusy/models/entities_service_response.rb', line 39

def price_model_id
  @price_model_id
end

#resourcesList of Integer

array of Resource ids offering Service

Returns:

  • (List of Integer)


43
44
45
# File 'lib/gonebusy/models/entities_service_response.rb', line 43

def resources
  @resources
end

#short_nameString

abbreviated name for Service

Returns:



47
48
49
# File 'lib/gonebusy/models/entities_service_response.rb', line 47

def short_name
  @short_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



96
97
98
99
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
# File 'lib/gonebusy/models/entities_service_response.rb', line 96

def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash

    categories = hash["categories"]
    description = hash["description"]
    duration = hash["duration"]
    max_duration = hash["max_duration"]
    id = hash["id"]
    is_active = hash["is_active"]
    name = hash["name"]
    owner_id = hash["owner_id"]
    price_model_id = hash["price_model_id"]
    resources = hash["resources"]
    schedules = hash["schedules"]
    short_name = hash["short_name"]

    # Create object from extracted values

    EntitiesServiceResponse.new(categories,
                                description,
                                duration,
                                max_duration,
                                id,
                                is_active,
                                name,
                                owner_id,
                                price_model_id,
                                resources,
                                schedules,
                                short_name)
  end
end

.namesObject

A mapping from model property names to API property names



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/gonebusy/models/entities_service_response.rb', line 50

def self.names
  if @hash.nil?
    @hash = {}
    @hash["categories"] = "categories"
    @hash["description"] = "description"
    @hash["duration"] = "duration"
    @hash["max_duration"] = "max_duration"
    @hash["id"] = "id"
    @hash["is_active"] = "is_active"
    @hash["name"] = "name"
    @hash["owner_id"] = "owner_id"
    @hash["price_model_id"] = "price_model_id"
    @hash["resources"] = "resources"
    @hash["schedules"] = "schedules"
    @hash["short_name"] = "short_name"
  end
  @hash
end