Class: Gonebusy::EntitiesPricingModelResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/entities_pricing_model_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(id = nil, owner_id = nil, name = nil, notes = nil, pricing_model_type = nil, price = nil, currency = nil) ⇒ EntitiesPricingModelResponse

Returns a new instance of EntitiesPricingModelResponse.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/gonebusy/models/entities_pricing_model_response.rb', line 48

def initialize(id = nil,
               owner_id = nil,
               name = nil,
               notes = nil,
               pricing_model_type = nil,
               price = nil,
               currency = nil)
  @id = id
  @owner_id = owner_id
  @name = name
  @notes = notes
  @pricing_model_type = pricing_model_type
  @price = price
  @currency = currency
end

Instance Attribute Details

#currencyString

currency symbol, as per ISO-4217

Returns:



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

def currency
  @currency
end

#idInteger

id of PricingModel

Returns:

  • (Integer)


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

def id
  @id
end

#nameString

name of PricingModel

Returns:



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

def name
  @name
end

#notesString

notes and description

Returns:



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

def notes
  @notes
end

#owner_idInteger

id of owner of PricingModel

Returns:

  • (Integer)


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

def owner_id
  @owner_id
end

#priceString

price/rate

Returns:



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

def price
  @price
end

#pricing_model_typeString

type of PricingModel

Returns:



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

def pricing_model_type
  @pricing_model_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/gonebusy/models/entities_pricing_model_response.rb', line 65

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']
  notes = hash['notes']
  pricing_model_type = hash['pricing_model_type']
  price = hash['price']
  currency = hash['currency']

  # Create object from extracted values
  EntitiesPricingModelResponse.new(id,
                                   owner_id,
                                   name,
                                   notes,
                                   pricing_model_type,
                                   price,
                                   currency)
end

.namesObject

A mapping from model property names to API property names



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/gonebusy/models/entities_pricing_model_response.rb', line 34

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash["id"] = "id"
    @_hash["owner_id"] = "owner_id"
    @_hash["name"] = "name"
    @_hash["notes"] = "notes"
    @_hash["pricing_model_type"] = "pricing_model_type"
    @_hash["price"] = "price"
    @_hash["currency"] = "currency"
  end
  @_hash
end