Class: Smspilot::Api
Direct Known Subclasses
Client
Constant Summary
collapse
- NOT_FOUND_STATUS =
"-2"
- NOT_DELIVERED_STATUS =
"-1"
- ACCEPTED_STATUS =
"0"
- AT_OPERATOR_STATUS =
"1"
- DELIVERED_STATUS =
"2"
Instance Method Summary
collapse
Methods included from Request
#request_json, #send_request
Constructor Details
#initialize(options = {}) ⇒ Api
Returns a new instance of Api.
Instance Method Details
#check_balance ⇒ Object
39
40
41
42
|
# File 'lib/smspilot/api.rb', line 39
def check_balance
body = {"balance" => [{"balance" => true}]}
send_request body
end
|
#check_balance! ⇒ Object
57
58
59
60
61
|
# File 'lib/smspilot/api.rb', line 57
def check_balance!
response = check_balance
raise response.error if response.error.kind_of? StandardError
response
end
|
#check_sms_status(sms_server_id) ⇒ Object
33
34
35
36
37
|
# File 'lib/smspilot/api.rb', line 33
def check_sms_status(sms_server_id)
body = {"check" => [{"server_id" => sms_server_id}]}
response = send_request body
enhance_response(response, "check")
end
|
#check_sms_status!(sms_server_id) ⇒ Object
51
52
53
54
55
|
# File 'lib/smspilot/api.rb', line 51
def check_sms_status! (sms_server_id)
response = check_sms_status (sms_server_id)
raise response.error if response.error.kind_of? StandardError
response
end
|
#send_sms(sms_id, sms_from, sms_to, message_text) ⇒ Object
27
28
29
30
31
|
# File 'lib/smspilot/api.rb', line 27
def send_sms(sms_id, sms_from, sms_to, message_text)
body = {:send => [{:id => sms_id.to_s, :from => sms_from.to_s, :to => sms_to.to_s, :text => message_text.to_s}]}
response = send_request body
enhance_response(response, "send")
end
|
#send_sms!(sms_id, sms_from, sms_to, message_text) ⇒ Object
45
46
47
48
49
|
# File 'lib/smspilot/api.rb', line 45
def send_sms!(sms_id, sms_from, sms_to, message_text)
response = send_sms(sms_id, sms_from, sms_to, message_text)
raise response.error if response.error.kind_of? StandardError
response
end
|