Module: SendSonar
- Extended by:
- SendSonar
- Included in:
- SendSonar
- Defined in:
- lib/send_sonar.rb,
lib/send_sonar/client.rb,
lib/send_sonar/version.rb,
lib/send_sonar/exceptions.rb,
lib/send_sonar/configuration.rb
Defined Under Namespace
Modules: Client, Exceptions
Classes: ApiDisabledForCompany, BadRequest, BadToken, Configuration, ConfigurationError, ConnectionRefused, Customer, Exception, InvalidPhoneNumber, Message, NoActiveSubscription, RequestException, RequestTimeout, Response, TokenOrPublishableKeyNotFound, UnknownRequestError
Constant Summary
collapse
- VERSION =
"2.0.0"
Instance Method Summary
collapse
Instance Method Details
#add_customer(params) ⇒ Object
Also known as:
add_update_customer
16
17
18
19
|
# File 'lib/send_sonar.rb', line 16
def add_customer params
resp = Client.post url_for(:customers), params,
Customer.new(JSON.parse(resp))
end
|
#available_phone_number ⇒ Object
51
52
53
54
55
|
# File 'lib/send_sonar.rb', line 51
def available_phone_number
= { :publishable_key => true, :token => false }
resp = Client.get url_for(:available_phone_number), ()
Response.new(JSON.parse(resp))
end
|
#close_customer(params) ⇒ Object
33
34
35
36
|
# File 'lib/send_sonar.rb', line 33
def close_customer params
resp = Client.post url_for(:close_customer), params,
Response.new(JSON.parse(resp))
end
|
12
13
14
|
# File 'lib/send_sonar.rb', line 12
def configure
yield @config ||= Configuration.new
end
|
#delete_customer_property(params) ⇒ Object
38
39
40
41
|
# File 'lib/send_sonar.rb', line 38
def delete_customer_property params
resp = Client.delete url_for(:delete_customer_property), params,
Response.new(JSON.parse(resp))
end
|
#get_customer(params) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/send_sonar.rb', line 43
def get_customer params
query = params.merge({ :token => config.token })
resp = Client.get url_for(:customers), { params: query }
Customer.new(JSON.parse(resp))
end
|
#message_customer(params) ⇒ Object
23
24
25
26
|
# File 'lib/send_sonar.rb', line 23
def message_customer params
resp = Client.post url_for(:messages), params,
Message.new(JSON.parse(resp))
end
|
#send_campaign(params) ⇒ Object
28
29
30
31
|
# File 'lib/send_sonar.rb', line 28
def send_campaign params
resp = Client.post url_for(:campaigns), params,
Response.new(JSON.parse(resp))
end
|