Class: OpenMarket::CarrierLookupResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/open_market/response.rb

Instance Attribute Summary collapse

Attributes inherited from Response

#code, #description

Instance Method Summary collapse

Constructor Details

#initialize(http_response) ⇒ CarrierLookupResponse

Returns a new instance of CarrierLookupResponse.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/open_market/response.rb', line 30

def initialize(http_response)
  super
  if destination = xml.elements["destination"]
    @country_code = destination.attributes["country_code"].to_i
    @national_number = destination.attributes["national_number"]
    @intl_notation = destination.attributes["intl_notation"]
    @area_code = destination.attributes["area_code"]
    @area_code_length = destination.attributes["area_code_length"].to_i
    @num_min_length = destination.attributes["num_min_length"].to_i
    @num_max_length = destination.attributes["num_max_length"].to_i
    @na_nxx = destination.attributes["na_nxx"]
    @na_line = destination.attributes["na_line"]
    @local_notation = destination.attributes["local_notation"]
    @local_format = destination.attributes["local_format"]
    @digits_all = destination.attributes["digits_all"].to_i
    @digits_local = destination.attributes["digits_local"].to_i
    @ported = destination.attributes["ported"] == "true"
    @ported_from = destination.attributes["ported_from"]
  end
  if location = xml.elements["location"]
    @city = location.attributes["city"]
    @country = location.attributes["country"]
    @country_name = location.attributes["country_name"]
    @estimated_latitude = location.attributes["estimated_latitude"].to_f
    @estimated_longitude = location.attributes["estimated_longitude"].to_f
    @region = location.attributes["region"]
    @region_name = location.attributes["region_name"]
    @timezone_min = location.attributes["timezone_min"].to_i
    @timezone_max= location.attributes["timezone_max"].to_i
    @zone = location.attributes["zone"].to_i
    @zone_name = location.attributes["zone_name"]
  end
  if operator = xml.elements["operator"]
    @carrier_id = operator.attributes["id"].to_i
    @name = operator.attributes["name"]
    @binary_length = operator.attributes["binary_length"].to_i
    @text_length = operator.attributes["text_length"].to_i
    @unicode_length = operator.attributes["unicode_length"].to_i
    @binary = operator.attributes["binary"] == "true"
    @ems = operator.attributes["ems"] == "true"
    @smart_messaging = operator.attributes["smart_messaging"] == "true"
    @unicode = operator.attributes["unicode"] == "true"
    @wap_push = operator.attributes["wap_push"] == "true"
  end
end

Instance Attribute Details

#area_codeObject (readonly)

Returns the value of attribute area_code.



26
27
28
# File 'lib/open_market/response.rb', line 26

def area_code
  @area_code
end

#area_code_lengthObject (readonly)

Returns the value of attribute area_code_length.



26
27
28
# File 'lib/open_market/response.rb', line 26

def area_code_length
  @area_code_length
end

#binaryObject (readonly)

Returns the value of attribute binary.



28
29
30
# File 'lib/open_market/response.rb', line 28

def binary
  @binary
end

#binary_lengthObject (readonly)

Returns the value of attribute binary_length.



28
29
30
# File 'lib/open_market/response.rb', line 28

def binary_length
  @binary_length
end

#carrier_idObject (readonly)

Returns the value of attribute carrier_id.



28
29
30
# File 'lib/open_market/response.rb', line 28

def carrier_id
  @carrier_id
end

#cityObject (readonly)

Returns the value of attribute city.



27
28
29
# File 'lib/open_market/response.rb', line 27

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



27
28
29
# File 'lib/open_market/response.rb', line 27

def country
  @country
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



26
27
28
# File 'lib/open_market/response.rb', line 26

def country_code
  @country_code
end

#country_nameObject (readonly)

Returns the value of attribute country_name.



27
28
29
# File 'lib/open_market/response.rb', line 27

def country_name
  @country_name
end

#digits_allObject (readonly)

Returns the value of attribute digits_all.



26
27
28
# File 'lib/open_market/response.rb', line 26

def digits_all
  @digits_all
end

#digits_localObject (readonly)

Returns the value of attribute digits_local.



26
27
28
# File 'lib/open_market/response.rb', line 26

def digits_local
  @digits_local
end

#emsObject (readonly)

Returns the value of attribute ems.



28
29
30
# File 'lib/open_market/response.rb', line 28

def ems
  @ems
end

#estimated_latitudeObject (readonly)

Returns the value of attribute estimated_latitude.



27
28
29
# File 'lib/open_market/response.rb', line 27

def estimated_latitude
  @estimated_latitude
end

#estimated_longitudeObject (readonly)

Returns the value of attribute estimated_longitude.



27
28
29
# File 'lib/open_market/response.rb', line 27

def estimated_longitude
  @estimated_longitude
end

#intl_notationObject (readonly)

Returns the value of attribute intl_notation.



26
27
28
# File 'lib/open_market/response.rb', line 26

def intl_notation
  @intl_notation
end

#local_formatObject (readonly)

Returns the value of attribute local_format.



26
27
28
# File 'lib/open_market/response.rb', line 26

def local_format
  @local_format
end

#local_notationObject (readonly)

Returns the value of attribute local_notation.



26
27
28
# File 'lib/open_market/response.rb', line 26

def local_notation
  @local_notation
end

#na_lineObject (readonly)

Returns the value of attribute na_line.



26
27
28
# File 'lib/open_market/response.rb', line 26

def na_line
  @na_line
end

#na_nxxObject (readonly)

Returns the value of attribute na_nxx.



26
27
28
# File 'lib/open_market/response.rb', line 26

def na_nxx
  @na_nxx
end

#nameObject (readonly)

Returns the value of attribute name.



28
29
30
# File 'lib/open_market/response.rb', line 28

def name
  @name
end

#national_numberObject (readonly)

Returns the value of attribute national_number.



26
27
28
# File 'lib/open_market/response.rb', line 26

def national_number
  @national_number
end

#num_max_lengthObject (readonly)

Returns the value of attribute num_max_length.



26
27
28
# File 'lib/open_market/response.rb', line 26

def num_max_length
  @num_max_length
end

#num_min_lengthObject (readonly)

Returns the value of attribute num_min_length.



26
27
28
# File 'lib/open_market/response.rb', line 26

def num_min_length
  @num_min_length
end

#portedObject (readonly)

Returns the value of attribute ported.



26
27
28
# File 'lib/open_market/response.rb', line 26

def ported
  @ported
end

#ported_fromObject (readonly)

Returns the value of attribute ported_from.



26
27
28
# File 'lib/open_market/response.rb', line 26

def ported_from
  @ported_from
end

#regionObject (readonly)

Returns the value of attribute region.



27
28
29
# File 'lib/open_market/response.rb', line 27

def region
  @region
end

#region_nameObject (readonly)

Returns the value of attribute region_name.



27
28
29
# File 'lib/open_market/response.rb', line 27

def region_name
  @region_name
end

#smart_messagingObject (readonly)

Returns the value of attribute smart_messaging.



28
29
30
# File 'lib/open_market/response.rb', line 28

def smart_messaging
  @smart_messaging
end

#text_lengthObject (readonly)

Returns the value of attribute text_length.



28
29
30
# File 'lib/open_market/response.rb', line 28

def text_length
  @text_length
end

#timezone_maxObject (readonly)

Returns the value of attribute timezone_max.



27
28
29
# File 'lib/open_market/response.rb', line 27

def timezone_max
  @timezone_max
end

#timezone_minObject (readonly)

Returns the value of attribute timezone_min.



27
28
29
# File 'lib/open_market/response.rb', line 27

def timezone_min
  @timezone_min
end

#unicodeObject (readonly)

Returns the value of attribute unicode.



28
29
30
# File 'lib/open_market/response.rb', line 28

def unicode
  @unicode
end

#unicode_lengthObject (readonly)

Returns the value of attribute unicode_length.



28
29
30
# File 'lib/open_market/response.rb', line 28

def unicode_length
  @unicode_length
end

#wap_pushObject (readonly)

Returns the value of attribute wap_push.



28
29
30
# File 'lib/open_market/response.rb', line 28

def wap_push
  @wap_push
end

#zoneObject (readonly)

Returns the value of attribute zone.



27
28
29
# File 'lib/open_market/response.rb', line 27

def zone
  @zone
end

#zone_nameObject (readonly)

Returns the value of attribute zone_name.



27
28
29
# File 'lib/open_market/response.rb', line 27

def zone_name
  @zone_name
end