Class: Sendly::PhoneNumber

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/numbers_resource.rb

Overview

A number owned by the account.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ PhoneNumber

Returns a new instance of PhoneNumber.



47
48
49
50
51
52
53
54
55
# File 'lib/sendly/numbers_resource.rb', line 47

def initialize(data)
  @id = data["id"]
  @phone_number = data["phoneNumber"] || data["phone_number"]
  @status = data["status"]
  @source = data["source"]
  @country_code = data["countryCode"] || data["country_code"]
  @phone_number_type = data["phoneNumberType"] || data["phone_number_type"]
  @monthly_cost_cents = data["monthlyCostCents"] || data["monthly_cost_cents"]
end

Instance Attribute Details

#country_codeObject (readonly)

Returns the value of attribute country_code.



44
45
46
# File 'lib/sendly/numbers_resource.rb', line 44

def country_code
  @country_code
end

#idObject (readonly)

Returns the value of attribute id.



44
45
46
# File 'lib/sendly/numbers_resource.rb', line 44

def id
  @id
end

#monthly_cost_centsObject (readonly)

Returns the value of attribute monthly_cost_cents.



44
45
46
# File 'lib/sendly/numbers_resource.rb', line 44

def monthly_cost_cents
  @monthly_cost_cents
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



44
45
46
# File 'lib/sendly/numbers_resource.rb', line 44

def phone_number
  @phone_number
end

#phone_number_typeObject (readonly)

Returns the value of attribute phone_number_type.



44
45
46
# File 'lib/sendly/numbers_resource.rb', line 44

def phone_number_type
  @phone_number_type
end

#sourceObject (readonly)

Returns the value of attribute source.



44
45
46
# File 'lib/sendly/numbers_resource.rb', line 44

def source
  @source
end

#statusObject (readonly)

Returns the value of attribute status.



44
45
46
# File 'lib/sendly/numbers_resource.rb', line 44

def status
  @status
end

Instance Method Details

#to_hObject



57
58
59
60
61
62
63
# File 'lib/sendly/numbers_resource.rb', line 57

def to_h
  {
    id: id, phone_number: phone_number, status: status, source: source,
    country_code: country_code, phone_number_type: phone_number_type,
    monthly_cost_cents: monthly_cost_cents
  }.compact
end