simple_desk 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -2
- data/RELEASE.md +4 -0
- data/lib/simple_desk/version.rb +1 -1
- data/lib/simple_desk.rb +53 -41
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b70d23fdd77697269c4c0d6b1bf33e987ed51c6
|
4
|
+
data.tar.gz: 75255aa85e2e519deebce54a7412ae9dcd3636ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eca9cf67e9733c8c30ecc59f0b4f7a5686016bba3625bdbe23c792339d66904400e6fbde123e8e6eb3e99efb66b8788436766ee7de59ba0fc6baf587fdf4ee45
|
7
|
+
data.tar.gz: 05496ee1873dfc428b74b0c8eba57b4069e47efc8c736f2294256ca259909980d7ca7c134deff6690960147a28e4dcca2426d83174dbbefb66f16dca585410df
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SimpleDesk
|
2
2
|
|
3
|
-
[Simple Desk](https://www.getsimpledesk.com) is
|
3
|
+
[Simple Desk](https://www.getsimpledesk.com) is an SMS customer engagement platform that allows companies to have 2-way conversations with their customers over SMS - whether it's for sales, customer service, funnel abandonment, or transactional messages.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -36,7 +36,15 @@ Like this:
|
|
36
36
|
|
37
37
|
params = {phone_number: "1231231232", email: "elijah@example.com", first_name: "Elijah", last_name: "Murray"}
|
38
38
|
SimpleDesk.add_customer(params)
|
39
|
-
|
39
|
+
|
40
|
+
You can also add any amount of additional properties like so (using phone_number as the identifier):
|
41
|
+
|
42
|
+
properties = {revenue_amount: "$100", location: "San Francisco"}
|
43
|
+
SimpleDesk.add_customer({phone_number: "1231231232"}, properties)
|
44
|
+
|
45
|
+
The gem will turn the properties into a Base64 encoded json object automatically.
|
46
|
+
|
47
|
+
You can use params and properties in the same add_customer call too!
|
40
48
|
|
41
49
|
###**Messaging**
|
42
50
|
To message a user the format is similar
|
@@ -52,6 +60,7 @@ Features that still need to be implemented
|
|
52
60
|
- Add ability to pass in properties and convert to base 64
|
53
61
|
- Add auto capitalization for names
|
54
62
|
- Parse formatting for phone number
|
63
|
+
- Update readme to explain setting up [IFTTT](https://ifttt.com/recipes/1110-send-an-sms-when-a-new-gmail-is-from-a-specific-email-address)
|
55
64
|
|
56
65
|
## Contributing
|
57
66
|
|
data/RELEASE.md
CHANGED
data/lib/simple_desk/version.rb
CHANGED
data/lib/simple_desk.rb
CHANGED
@@ -3,46 +3,58 @@ require "net/http"
|
|
3
3
|
require "uri"
|
4
4
|
|
5
5
|
module SimpleDesk
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
6
|
+
BASE_URL = "https://www.getsimpledesk.com"
|
7
|
+
|
8
|
+
def self.add_customer(params, customer_properties = nil)
|
9
|
+
unless customer_properties.blank?
|
10
|
+
props = Base64.urlsafe_encode64(customer_properties.to_json)
|
11
|
+
params = params.merge(properties: props)
|
12
|
+
end
|
13
|
+
url = URI.parse(post_url("add_customer"))
|
14
|
+
req = Net::HTTP::Post.new(url.request_uri)
|
15
|
+
req.set_form_data(params)
|
16
|
+
http = Net::HTTP.new(url.host, url.port)
|
17
|
+
http.use_ssl = true
|
18
|
+
response = http.request(req)
|
19
|
+
end
|
20
|
+
# alias_method :update_customer, :add_customer
|
21
|
+
|
22
|
+
def self.message_customer(message_and_phone_number)
|
23
|
+
url = URI.parse(post_url("message_customer"))
|
24
|
+
req = Net::HTTP::Post.new(url.request_uri)
|
25
|
+
req.set_form_data(message_and_phone_number)
|
26
|
+
http = Net::HTTP.new(url.host, url.port)
|
27
|
+
http.use_ssl = true
|
28
|
+
response = http.request(req)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def self.build_url(post_type = nil, params=nil)
|
33
|
+
url = post_url(post_type)
|
34
|
+
|
35
|
+
if params
|
36
|
+
string = ''
|
37
|
+
url << "&"
|
38
|
+
params.each { |k,v| string << "#{k}=#{v}&" }
|
39
|
+
|
40
|
+
url << string
|
41
|
+
url = url[0...-1] if (url[-1] == '&')
|
42
|
+
end
|
43
|
+
|
44
|
+
return url
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.post_url(post_type)
|
48
|
+
if post_type == nil
|
49
|
+
"#{BASE_URL}?token=#{ENV['SIMPLE_DESK_TOKEN'] || CONFIG['simple_desk_token']}"
|
50
|
+
else
|
51
|
+
case post_type
|
52
|
+
when "message_customer"
|
53
|
+
"#{BASE_URL}/api_send_message?token=#{ENV['SIMPLE_DESK_TOKEN'] || CONFIG['simple_desk_token']}"
|
54
|
+
when "add_customer" || "update_customer"
|
55
|
+
"#{BASE_URL}/api_add_customer?token=#{ENV['SIMPLE_DESK_TOKEN'] || CONFIG['simple_desk_token']}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
47
59
|
|
48
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_desk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elijah Murray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -104,11 +104,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.1.9
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: Provides a clean and simple gem to connect to Simple Desk
|
111
111
|
test_files:
|
112
112
|
- spec/my_spec.rb
|
113
113
|
- spec/spec_helper.rb
|
114
|
-
has_rdoc:
|