Class: CellForce::MobileDevice

Inherits:
Object
  • Object
show all
Includes:
DefaultShortCode
Defined in:
lib/cell_force/mobile_device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DefaultShortCode

#short_code_id

Constructor Details

#initialize(phone, short_code = nil) ⇒ MobileDevice

Returns a new instance of MobileDevice.



9
10
11
# File 'lib/cell_force/mobile_device.rb', line 9

def initialize(phone, short_code=nil)
  @phone, @short_code = phone, short_code
end

Instance Attribute Details

#phoneObject (readonly)

Returns the value of attribute phone.



8
9
10
# File 'lib/cell_force/mobile_device.rb', line 8

def phone
  @phone
end

#short_codeObject (readonly)

Returns the value of attribute short_code.



8
9
10
# File 'lib/cell_force/mobile_device.rb', line 8

def short_code
  @short_code
end

Instance Method Details

#send_mt(message) ⇒ Object



13
14
15
# File 'lib/cell_force/mobile_device.rb', line 13

def send_mt(message)
  Api.post(Api::SEND_SMS_RESOURCE, sms_validation: SmsValidation::Sms.new(phone, message), shortcode_id: short_code_id).data["mt_id"]
end

#simulate_mo(keyword, campaign_options = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/cell_force/mobile_device.rb', line 17

def simulate_mo(keyword, campaign_options={})
  tcpa_opt_in_campaign = TcpaOptInCampaign.new(keyword)
  if tcpa_opt_in_campaign.campaign_ids.empty?
    tcpa_opt_in_campaign.create_campaign(campaign_options)
  end
  Api.post("sms/mo", cellnumber: phone, message: keyword, shortcode_id: short_code_id, carrier_id: carrier_id, trigger: "DOUBLEOPTIN")
end