Module: AussieSMS

Extended by:
AussieSMS
Included in:
AussieSMS
Defined in:
lib/aussiesms.rb

Constant Summary collapse

API_URL =
"https://api.aussiesms.com.au"

Instance Method Summary collapse

Instance Method Details

#balanceObject



60
61
62
63
64
65
# File 'lib/aussiesms.rb', line 60

def balance
  apicall("querybalance", {
    :mobileID => @id,
    :password => @password
  }).body.to_i
end

#fromObject



27
28
29
# File 'lib/aussiesms.rb', line 27

def from
  @from
end

#from=(value) ⇒ Object



31
32
33
# File 'lib/aussiesms.rb', line 31

def from=(value)
  @from = value
end

#idObject



11
12
13
# File 'lib/aussiesms.rb', line 11

def id
  @id
end

#id=(value) ⇒ Object



15
16
17
# File 'lib/aussiesms.rb', line 15

def id=(value)
  @id = value
end

#passwordObject



19
20
21
# File 'lib/aussiesms.rb', line 19

def password
  @password
end

#password=(value) ⇒ Object



23
24
25
# File 'lib/aussiesms.rb', line 23

def password=(value)
  @password = value
end

#send(message, options = {}) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/aussiesms.rb', line 35

def send(message, options={})
  send_resp = apicall("sendsms", {
    :text => message,
    :to => options[:to],
    :from => options[:from] || @from,
    :mobileID => @id,
    :password => @password,
    :msg_type => "SMS_TEXT"
  })

  msg_id = send_resp.body.split(':')[1]

  check_resp = apicall("querymessage", {
    :mobileID => @id,
    :password => @password,
    :msg_id => msg_id
  })

  if check_resp.body.split(':')[0] != '1'
    false
  else
    true
  end
end