Class: MessageMediaLookups::LookupAPhoneNumberResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/message_media_lookups/models/lookup_a_phone_number_response.rb

Overview

LookupAPhoneNumberResponse 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, phone_number = nil, type = nil, carrier = nil) ⇒ LookupAPhoneNumberResponse

Returns a new instance of LookupAPhoneNumberResponse.



31
32
33
34
35
36
37
38
39
# File 'lib/message_media_lookups/models/lookup_a_phone_number_response.rb', line 31

def initialize(country_code = nil,
               phone_number = nil,
               type = nil,
               carrier = nil)
  @country_code = country_code
  @phone_number = phone_number
  @type = type
  @carrier = carrier
end

Instance Attribute Details

#carrierObject

TODO: Write general description for this method

Returns:

  • (Object)


19
20
21
# File 'lib/message_media_lookups/models/lookup_a_phone_number_response.rb', line 19

def carrier
  @carrier
end

#country_codeString

TODO: Write general description for this method

Returns:



7
8
9
# File 'lib/message_media_lookups/models/lookup_a_phone_number_response.rb', line 7

def country_code
  @country_code
end

#phone_numberString

TODO: Write general description for this method

Returns:



11
12
13
# File 'lib/message_media_lookups/models/lookup_a_phone_number_response.rb', line 11

def phone_number
  @phone_number
end

#typeString

TODO: Write general description for this method

Returns:



15
16
17
# File 'lib/message_media_lookups/models/lookup_a_phone_number_response.rb', line 15

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/message_media_lookups/models/lookup_a_phone_number_response.rb', line 42

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  country_code = hash['country_code']
  phone_number = hash['phone_number']
  type = hash['type']
  carrier = hash['carrier']

  # Create object from extracted values.
  LookupAPhoneNumberResponse.new(country_code,
                                 phone_number,
                                 type,
                                 carrier)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
28
29
# File 'lib/message_media_lookups/models/lookup_a_phone_number_response.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['country_code'] = 'country_code'
  @_hash['phone_number'] = 'phone_number'
  @_hash['type'] = 'type'
  @_hash['carrier'] = 'carrier'
  @_hash
end