Class: Asdawqw::Pms

Inherits:
BaseModel show all
Defined in:
lib/asdawqw/models/pms.rb

Overview

Property Manager model

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, name = nil, extra_name = nil, email_address = nil) ⇒ Pms

Returns a new instance of Pms.



35
36
37
38
39
40
41
42
43
# File 'lib/asdawqw/models/pms.rb', line 35

def initialize(id = nil,
               name = nil,
               extra_name = nil,
               email_address = nil)
  @id = id
  @name = name
  @extra_name = extra_name
  @email_address = email_address
end

Instance Attribute Details

#email_addressString

Email of the property manager

Returns:



23
24
25
# File 'lib/asdawqw/models/pms.rb', line 23

def email_address
  @email_address
end

#extra_nameString

Contact person

Returns:



19
20
21
# File 'lib/asdawqw/models/pms.rb', line 19

def extra_name
  @extra_name
end

#idInteger

ID of the property manager

Returns:

  • (Integer)


11
12
13
# File 'lib/asdawqw/models/pms.rb', line 11

def id
  @id
end

#nameString

Name of the property manager’s company

Returns:



15
16
17
# File 'lib/asdawqw/models/pms.rb', line 15

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/asdawqw/models/pms.rb', line 46

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash['id']
  name = hash['name']
  extra_name = hash['extraName']
  email_address = hash['emailAddress']

  # Create object from extracted values.
  Pms.new(id,
          name,
          extra_name,
          email_address)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
33
# File 'lib/asdawqw/models/pms.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['extra_name'] = 'extraName'
  @_hash['email_address'] = 'emailAddress'
  @_hash
end