Class: MundiApi::CreatePhoneRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mundi_api/models/create_phone_request.rb

Overview

CreatePhoneRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(country_code = nil, number = nil, area_code = nil) ⇒ CreatePhoneRequest

Returns a new instance of CreatePhoneRequest.



30
31
32
33
34
35
36
# File 'lib/mundi_api/models/create_phone_request.rb', line 30

def initialize(country_code = nil,
               number = nil,
               area_code = nil)
  @country_code = country_code
  @number = number
  @area_code = area_code
end

Instance Attribute Details

#area_codeString

TODO: Write general description for this method

Returns:



17
18
19
# File 'lib/mundi_api/models/create_phone_request.rb', line 17

def area_code
  @area_code
end

#country_codeString

TODO: Write general description for this method

Returns:



9
10
11
# File 'lib/mundi_api/models/create_phone_request.rb', line 9

def country_code
  @country_code
end

#numberString

TODO: Write general description for this method

Returns:



13
14
15
# File 'lib/mundi_api/models/create_phone_request.rb', line 13

def number
  @number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  country_code = hash['country_code']
  number = hash['number']
  area_code = hash['area_code']

  # Create object from extracted values.

  CreatePhoneRequest.new(country_code,
                         number,
                         area_code)
end

.namesObject

A mapping from model property names to API property names.



20
21
22
23
24
25
26
27
28
# File 'lib/mundi_api/models/create_phone_request.rb', line 20

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash['country_code'] = 'country_code'
    @_hash['number'] = 'number'
    @_hash['area_code'] = 'area_code'
  end
  @_hash
end