Class: Sendly::AvailableNumber
- Inherits:
-
Object
- Object
- Sendly::AvailableNumber
- Defined in:
- lib/sendly/numbers_resource.rb
Overview
A number that is available to purchase. The monthly cost is already customer-priced and returned as a string in the given currency.
Instance Attribute Summary collapse
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#monthly_cost ⇒ Object
readonly
Returns the value of attribute monthly_cost.
-
#number_type ⇒ Object
readonly
Returns the value of attribute number_type.
-
#phone_number ⇒ Object
readonly
Returns the value of attribute phone_number.
Instance Method Summary collapse
-
#initialize(data) ⇒ AvailableNumber
constructor
A new instance of AvailableNumber.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ AvailableNumber
Returns a new instance of AvailableNumber.
25 26 27 28 29 30 31 |
# File 'lib/sendly/numbers_resource.rb', line 25 def initialize(data) @phone_number = data["phoneNumber"] || data["phone_number"] @country = data["country"] @number_type = data["numberType"] || data["number_type"] @monthly_cost = data["monthlyCost"] || data["monthly_cost"] @currency = data["currency"] end |
Instance Attribute Details
#country ⇒ Object (readonly)
Returns the value of attribute country.
23 24 25 |
# File 'lib/sendly/numbers_resource.rb', line 23 def country @country end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
23 24 25 |
# File 'lib/sendly/numbers_resource.rb', line 23 def currency @currency end |
#monthly_cost ⇒ Object (readonly)
Returns the value of attribute monthly_cost.
23 24 25 |
# File 'lib/sendly/numbers_resource.rb', line 23 def monthly_cost @monthly_cost end |
#number_type ⇒ Object (readonly)
Returns the value of attribute number_type.
23 24 25 |
# File 'lib/sendly/numbers_resource.rb', line 23 def number_type @number_type end |
#phone_number ⇒ Object (readonly)
Returns the value of attribute phone_number.
23 24 25 |
# File 'lib/sendly/numbers_resource.rb', line 23 def phone_number @phone_number end |
Instance Method Details
#to_h ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/sendly/numbers_resource.rb', line 33 def to_h { phone_number: phone_number, country: country, number_type: number_type, monthly_cost: monthly_cost, currency: currency }.compact end |