Class: Bandwidth::LookupResult

Inherits:
ApiModelBase show all
Defined in:
lib/bandwidth-sdk/models/lookup_result.rb

Overview

Carrier information results for the specified telephone number.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ LookupResult

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 123

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupResult` initialize method'
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'phone_number')
    self.phone_number = attributes[:'phone_number']
  end

  if attributes.key?(:'line_type')
    self.line_type = attributes[:'line_type']
  end

  if attributes.key?(:'messaging_provider')
    self.messaging_provider = attributes[:'messaging_provider']
  end

  if attributes.key?(:'voice_provider')
    self.voice_provider = attributes[:'voice_provider']
  end

  if attributes.key?(:'country_code_a3')
    self.country_code_a3 = attributes[:'country_code_a3']
  end

  if attributes.key?(:'deactivation_reporter')
    self.deactivation_reporter = attributes[:'deactivation_reporter']
  end

  if attributes.key?(:'deactivation_date')
    self.deactivation_date = attributes[:'deactivation_date']
  end

  if attributes.key?(:'deactivation_event')
    self.deactivation_event = attributes[:'deactivation_event']
  end

  if attributes.key?(:'latest_message_delivery_status')
    self.latest_message_delivery_status = attributes[:'latest_message_delivery_status']
  end

  if attributes.key?(:'initial_message_delivery_status_date')
    self.initial_message_delivery_status_date = attributes[:'initial_message_delivery_status_date']
  end

  if attributes.key?(:'latest_message_delivery_status_date')
    self.latest_message_delivery_status_date = attributes[:'latest_message_delivery_status_date']
  end
end

Instance Attribute Details

#country_code_a3Object

The country code of the telephone number in ISO 3166-1 alpha-3 format.



31
32
33
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 31

def country_code_a3
  @country_code_a3
end

#deactivation_dateObject

[DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event.



37
38
39
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 37

def deactivation_date
  @deactivation_date
end

#deactivation_eventObject

Returns the value of attribute deactivation_event.



39
40
41
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 39

def deactivation_event
  @deactivation_event
end

#deactivation_reporterObject

[DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number.



34
35
36
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 34

def deactivation_reporter
  @deactivation_reporter
end

#initial_message_delivery_status_dateObject

[DNI-Only](#section/DNI-Only). The date the phone number entered the status described in ‘latestMessageDeliveryStatus`. Think of this as the "start time" for that status. Value resets every time the `latestMessageDeliveryStatus` changes.



44
45
46
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 44

def initial_message_delivery_status_date
  @initial_message_delivery_status_date
end

#latest_message_delivery_statusObject

Returns the value of attribute latest_message_delivery_status.



41
42
43
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 41

def latest_message_delivery_status
  @latest_message_delivery_status
end

#latest_message_delivery_status_dateObject

[DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the ‘latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes.



47
48
49
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 47

def latest_message_delivery_status_date
  @latest_message_delivery_status_date
end

#line_typeObject

Returns the value of attribute line_type.



22
23
24
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 22

def line_type
  @line_type
end

#messaging_providerObject

The messaging service provider of the telephone number.



25
26
27
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 25

def messaging_provider
  @messaging_provider
end

#phone_numberObject

The telephone number in E.164 format.



20
21
22
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 20

def phone_number
  @phone_number
end

#voice_providerObject

The voice service provider of the telephone number.



28
29
30
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 28

def voice_provider
  @voice_provider
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



89
90
91
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 89

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



94
95
96
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 94

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 72

def self.attribute_map
  {
    :'phone_number' => :'phoneNumber',
    :'line_type' => :'lineType',
    :'messaging_provider' => :'messagingProvider',
    :'voice_provider' => :'voiceProvider',
    :'country_code_a3' => :'countryCodeA3',
    :'deactivation_reporter' => :'deactivationReporter',
    :'deactivation_date' => :'deactivationDate',
    :'deactivation_event' => :'deactivationEvent',
    :'latest_message_delivery_status' => :'latestMessageDeliveryStatus',
    :'initial_message_delivery_status_date' => :'initialMessageDeliveryStatusDate',
    :'latest_message_delivery_status_date' => :'latestMessageDeliveryStatusDate'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 230

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



116
117
118
119
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 116

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 99

def self.openapi_types
  {
    :'phone_number' => :'String',
    :'line_type' => :'LineTypeEnum',
    :'messaging_provider' => :'String',
    :'voice_provider' => :'String',
    :'country_code_a3' => :'String',
    :'deactivation_reporter' => :'String',
    :'deactivation_date' => :'String',
    :'deactivation_event' => :'DeactivationEventEnum',
    :'latest_message_delivery_status' => :'LatestMessageDeliveryStatusEnum',
    :'initial_message_delivery_status_date' => :'Date',
    :'latest_message_delivery_status_date' => :'Date'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 199

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      phone_number == o.phone_number &&
      line_type == o.line_type &&
      messaging_provider == o.messaging_provider &&
      voice_provider == o.voice_provider &&
      country_code_a3 == o.country_code_a3 &&
      deactivation_reporter == o.deactivation_reporter &&
      deactivation_date == o.deactivation_date &&
      deactivation_event == o.deactivation_event &&
      latest_message_delivery_status == o.latest_message_delivery_status &&
      initial_message_delivery_status_date == o.initial_message_delivery_status_date &&
      latest_message_delivery_status_date == o.latest_message_delivery_status_date
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


217
218
219
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 217

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



223
224
225
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 223

def hash
  [phone_number, line_type, messaging_provider, voice_provider, country_code_a3, deactivation_reporter, deactivation_date, deactivation_event, latest_message_delivery_status, initial_message_delivery_status_date, latest_message_delivery_status_date].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



184
185
186
187
188
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 184

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 252

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



192
193
194
195
# File 'lib/bandwidth-sdk/models/lookup_result.rb', line 192

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end