Module: PigeonFu::Sms::InstanceMethods

Defined in:
lib/pigeon_fu/sms.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth=(value) ⇒ Object (writeonly)

Sets the attribute auth

Parameters:

  • value

    the value to set the attribute auth to.



50
51
52
# File 'lib/pigeon_fu/sms.rb', line 50

def auth=(value)
  @auth = value
end

#content=(value) ⇒ Object (writeonly)

Sets the attribute content

Parameters:

  • value

    the value to set the attribute content to.



50
51
52
# File 'lib/pigeon_fu/sms.rb', line 50

def content=(value)
  @content = value
end

#receivers=(value) ⇒ Object (writeonly)

Sets the attribute receivers

Parameters:

  • value

    the value to set the attribute receivers to.



50
51
52
# File 'lib/pigeon_fu/sms.rb', line 50

def receivers=(value)
  @receivers = value
end

#sender=(value) ⇒ Object (writeonly)

Sets the attribute sender

Parameters:

  • value

    the value to set the attribute sender to.



50
51
52
# File 'lib/pigeon_fu/sms.rb', line 50

def sender=(value)
  @sender = value
end

Instance Method Details

#send_message_to(receiver) ⇒ Object

Raises:



56
57
58
59
60
61
62
# File 'lib/pigeon_fu/sms.rb', line 56

def send_message_to(receiver)
  auth_token = @auth.run
  request_vars = {'SendMsgRequest' => [auth_token, receiver, @content, @sender].join("$")}
  response = PigeonFu::Rest.get(PigeonFu::SMS_INTERFACE_URL, request_vars)
  response_code = response.split("=")[1]
  raise SendSMSFailed, response_code unless response_code.to_i == 200
end

#send_phone_text_messageObject



52
53
54
# File 'lib/pigeon_fu/sms.rb', line 52

def send_phone_text_message
  @receivers.each { |receiver| send_message_to(receiver) }
end