Class: Sendly::NumberCountry
- Inherits:
-
Object
- Object
- Sendly::NumberCountry
- Defined in:
- lib/sendly/numbers_resource.rb
Overview
A country in which numbers can be searched and purchased, along with the number types available there (e.g. “mobile”, “local”, “toll_free”).
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number_types ⇒ Object
readonly
Returns the value of attribute number_types.
Instance Method Summary collapse
-
#initialize(data) ⇒ NumberCountry
constructor
A new instance of NumberCountry.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ NumberCountry
Returns a new instance of NumberCountry.
9 10 11 12 13 |
# File 'lib/sendly/numbers_resource.rb', line 9 def initialize(data) @code = data["code"] @name = data["name"] @number_types = data["numberTypes"] || data["number_types"] || [] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/sendly/numbers_resource.rb', line 7 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/sendly/numbers_resource.rb', line 7 def name @name end |
#number_types ⇒ Object (readonly)
Returns the value of attribute number_types.
7 8 9 |
# File 'lib/sendly/numbers_resource.rb', line 7 def number_types @number_types end |
Instance Method Details
#to_h ⇒ Object
15 16 17 |
# File 'lib/sendly/numbers_resource.rb', line 15 def to_h { code: code, name: name, number_types: number_types }.compact end |