Class: Sendly::PhoneNumber
- Inherits:
-
Object
- Object
- Sendly::PhoneNumber
- Defined in:
- lib/sendly/numbers_resource.rb
Overview
A number owned by the account.
Instance Attribute Summary collapse
-
#country_code ⇒ Object
readonly
Returns the value of attribute country_code.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#monthly_cost_cents ⇒ Object
readonly
Returns the value of attribute monthly_cost_cents.
-
#pending_cancellation ⇒ Object
readonly
Returns the value of attribute pending_cancellation.
-
#phone_number ⇒ Object
readonly
Returns the value of attribute phone_number.
-
#phone_number_type ⇒ Object
readonly
Returns the value of attribute phone_number_type.
-
#requirements_submitted_at ⇒ Object
readonly
Returns the value of attribute requirements_submitted_at.
-
#scheduled_release_at ⇒ Object
readonly
Returns the value of attribute scheduled_release_at.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(data) ⇒ PhoneNumber
constructor
A new instance of PhoneNumber.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ PhoneNumber
Returns a new instance of PhoneNumber.
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/sendly/numbers_resource.rb', line 54 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"] @requirements_submitted_at = data["requirementsSubmittedAt"] || data["requirements_submitted_at"] @pending_cancellation = data.key?("pendingCancellation") ? data["pendingCancellation"] : data["pending_cancellation"] @scheduled_release_at = data["scheduledReleaseAt"] || data["scheduled_release_at"] end |
Instance Attribute Details
#country_code ⇒ Object (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 |
#id ⇒ Object (readonly)
Returns the value of attribute id.
44 45 46 |
# File 'lib/sendly/numbers_resource.rb', line 44 def id @id end |
#monthly_cost_cents ⇒ Object (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 |
#pending_cancellation ⇒ Object (readonly)
Returns the value of attribute pending_cancellation.
44 45 46 |
# File 'lib/sendly/numbers_resource.rb', line 44 def pending_cancellation @pending_cancellation end |
#phone_number ⇒ Object (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_type ⇒ Object (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 |
#requirements_submitted_at ⇒ Object (readonly)
Returns the value of attribute requirements_submitted_at.
44 45 46 |
# File 'lib/sendly/numbers_resource.rb', line 44 def requirements_submitted_at @requirements_submitted_at end |
#scheduled_release_at ⇒ Object (readonly)
Returns the value of attribute scheduled_release_at.
44 45 46 |
# File 'lib/sendly/numbers_resource.rb', line 44 def scheduled_release_at @scheduled_release_at end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
44 45 46 |
# File 'lib/sendly/numbers_resource.rb', line 44 def source @source end |
#status ⇒ Object (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_h ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/sendly/numbers_resource.rb', line 67 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, requirements_submitted_at: requirements_submitted_at, pending_cancellation: pending_cancellation, scheduled_release_at: scheduled_release_at }.compact end |