Class: Sendly::TenDlcAssignment

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

Overview

A phone number assigned to a campaign. The number can send once the status is "Active".

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ TenDlcAssignment

Returns a new instance of TenDlcAssignment.



139
140
141
142
143
144
145
# File 'lib/sendly/tendlc_resource.rb', line 139

def initialize(data)
  @id = data["id"]
  @campaign_id = data["campaignId"] || data["campaign_id"]
  @phone_number = data["phoneNumber"] || data["phone_number"]
  @status = data["status"]
  @assigned_at = data["assignedAt"] || data["assigned_at"]
end

Instance Attribute Details

#assigned_atObject (readonly)

Returns the value of attribute assigned_at.



137
138
139
# File 'lib/sendly/tendlc_resource.rb', line 137

def assigned_at
  @assigned_at
end

#campaign_idObject (readonly)

Returns the value of attribute campaign_id.



137
138
139
# File 'lib/sendly/tendlc_resource.rb', line 137

def campaign_id
  @campaign_id
end

#idObject (readonly)

Returns the value of attribute id.



137
138
139
# File 'lib/sendly/tendlc_resource.rb', line 137

def id
  @id
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



137
138
139
# File 'lib/sendly/tendlc_resource.rb', line 137

def phone_number
  @phone_number
end

#statusObject (readonly)

Returns the value of attribute status.



137
138
139
# File 'lib/sendly/tendlc_resource.rb', line 137

def status
  @status
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


147
148
149
# File 'lib/sendly/tendlc_resource.rb', line 147

def active?
  status == "Active"
end

#to_hObject



151
152
153
154
155
156
# File 'lib/sendly/tendlc_resource.rb', line 151

def to_h
  {
    id: id, campaign_id: campaign_id, phone_number: phone_number,
    status: status, assigned_at: assigned_at
  }.compact
end