Class: Sendly::AvailableNumber

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#countryObject (readonly)

Returns the value of attribute country.



23
24
25
# File 'lib/sendly/numbers_resource.rb', line 23

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



23
24
25
# File 'lib/sendly/numbers_resource.rb', line 23

def currency
  @currency
end

#monthly_costObject (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_typeObject (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_numberObject (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_hObject



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