simple_desk 0.0.2 → 0.1.0
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 +8 -2
- data/lib/simple_desk/version.rb +1 -1
- data/lib/simple_desk.rb +7 -6
- data/spec/my_spec.rb +4 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c837638e0f2659034aa5a4c8b25215d7cdf0c302
|
4
|
+
data.tar.gz: 37f725e2a1109bb1e7fbc583a1c0be5b41d597dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37529b54d884a61c95e4b8ee190380160672953d0187c7b35b7dc92413b4b85566837be8d71e864a601e8ebaa6a9c50ce5e09b6b3b6d27f379b7ef6be3bf1831
|
7
|
+
data.tar.gz: 1575762f6493ef5a52c2fa0c19593bb6e554e72940c52f33d3a1f2c99b0cfa3bbbb88f3d479975520e25503fe061db9e0ab6e90c173362a9574f8804f2a97e52
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# SimpleDesk
|
2
2
|
|
3
|
-
|
3
|
+
[Simple Desk](https://www.getsimpledesk.com) is a skin on top of the twillio API which makes it much easier to use. This simple wrapper is a gem to quickly integrate with Simple Desk in seconds.
|
4
|
+
|
5
|
+
## To Do List
|
6
|
+
|
7
|
+
- Make generator to accept your API key
|
8
|
+
- Add ability to pass in properties and convert to base 64
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -18,7 +23,8 @@ Or install it yourself as:
|
|
18
23
|
|
19
24
|
## Usage
|
20
25
|
|
21
|
-
|
26
|
+
a = Api.new
|
27
|
+
a.add_customer({phone_number: "1231231234"})
|
22
28
|
|
23
29
|
## Contributing
|
24
30
|
|
data/lib/simple_desk/version.rb
CHANGED
data/lib/simple_desk.rb
CHANGED
@@ -2,18 +2,19 @@ require "simple_desk/version"
|
|
2
2
|
require "net/http"
|
3
3
|
require "uri"
|
4
4
|
|
5
|
-
|
5
|
+
module SimpleDesk
|
6
|
+
|
6
7
|
BASE_URL = "https://www.getsimpledesk.com"
|
7
8
|
TOKEN = ENV['SIMPLE_DESK_TOKEN'] || "ucMKQtZ0CQkgfGzTj6lOJe2VRvoRHM8z"
|
8
9
|
|
9
|
-
def add_customer(params)
|
10
|
+
def self.add_customer(params)
|
10
11
|
uri = URI.parse(post_url("add_customer"))
|
11
12
|
response = Net::HTTP.post_form(uri, params)
|
12
13
|
end
|
13
|
-
alias_method :update_customer, :add_customer
|
14
|
+
# alias_method :update_customer, :add_customer
|
14
15
|
|
15
16
|
|
16
|
-
def build_url(post_type = nil, params=nil)
|
17
|
+
def self.build_url(post_type = nil, params=nil)
|
17
18
|
url = post_url(post_type)
|
18
19
|
|
19
20
|
if params
|
@@ -28,7 +29,7 @@ class Api
|
|
28
29
|
return url
|
29
30
|
end
|
30
31
|
|
31
|
-
def post_url(post_type)
|
32
|
+
def self.post_url(post_type)
|
32
33
|
if post_type == nil
|
33
34
|
"#{BASE_URL}?token=#{TOKEN}"
|
34
35
|
else
|
@@ -41,7 +42,7 @@ class Api
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
44
|
-
def message_customer(message_and_phone_number)
|
45
|
+
def self.message_customer(message_and_phone_number)
|
45
46
|
uri = URI.parse(post_url("message_customer"))
|
46
47
|
response = Net::HTTP.post_form(uri, message_and_phone_number)
|
47
48
|
end
|
data/spec/my_spec.rb
CHANGED
@@ -1,23 +1,22 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require "simple_desk"
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleDesk do
|
5
5
|
before :each do
|
6
|
-
@api = Api.new
|
7
6
|
@phone = {phone_number: "555#{Random.rand(10_000_000 - 1_000_000)}"}
|
8
7
|
@user = {first_name: "Elijah", last_name: "Murray"}.merge!(@phone)
|
9
8
|
end
|
10
9
|
|
11
10
|
describe "#build_url" do
|
12
11
|
it "build_url returns a string" do
|
13
|
-
|
12
|
+
SimpleDesk.build_url.should eql "https://www.getsimpledesk.com?token=ucMKQtZ0CQkgfGzTj6lOJe2VRvoRHM8z"
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
17
16
|
describe "#add_customer" do
|
18
17
|
it "add customer successfully" do
|
19
18
|
# skip("disabled to not call API")
|
20
|
-
request =
|
19
|
+
request = SimpleDesk.add_customer(@user)
|
21
20
|
request.response.code.should eql "200"
|
22
21
|
end
|
23
22
|
end
|
@@ -28,7 +27,7 @@ describe Api do
|
|
28
27
|
message = "Hi customer!"
|
29
28
|
to = {to: @phone[:phone_number]}
|
30
29
|
params = {text: message}.merge!(to)
|
31
|
-
request =
|
30
|
+
request = SimpleDesk.message_customer(params)
|
32
31
|
request.response.code.should eql "200"
|
33
32
|
end
|
34
33
|
end
|