clickatellsend 1.1.0 → 1.1.1
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 +7 -9
- data/lib/clickatellsend.rb +1 -0
- data/lib/clickatellsend/clickatell_config.rb +22 -0
- data/lib/clickatellsend/clickatell_request.rb +11 -9
- data/lib/clickatellsend/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 869e385d3f11ff650e1f065a32b0cf8c8ca21ee8
|
|
4
|
+
data.tar.gz: faacb975021d65e5265b223f1f21f2dfeea3bbc4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6613609f774e39b2e9d2438373a3b48fd05ff58e8747e73b74376c4ab3154dd1878c69748dd439466ed16049e89185073b2f36803bb8f299cb99617ccb61b05
|
|
7
|
+
data.tar.gz: a61ca89c5c0dd8a1269cdca99b74283740b30f415002781059b46b98d8e0ccfc42e3b0d1f10af9eb0593f336d2ed88e7842d8b0ba2658e0212133a985ebc0d28
|
data/README.md
CHANGED
|
@@ -20,18 +20,16 @@ Or install it yourself as:
|
|
|
20
20
|
|
|
21
21
|
$ gem install clickatellsend
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Configuration
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
and go to config/initializers/clickatellsend.rb and fill with your credentials
|
|
25
|
+
To use the gem you need to set your credentials
|
|
28
26
|
|
|
29
27
|
```ruby
|
|
30
|
-
Clickatellsend.config do |
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
Clickatellsend.config do |config|
|
|
29
|
+
config.url = "http://api.clickatell.com/"
|
|
30
|
+
config.user = ENV['CLICKATELL_USER']
|
|
31
|
+
config.password = ENV['CLICKATELL_PASSWORD']
|
|
32
|
+
config.api_id = ENV['CLICKATELL_API_ID']
|
|
35
33
|
end
|
|
36
34
|
```
|
|
37
35
|
|
data/lib/clickatellsend.rb
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Clickatellsend
|
|
2
|
+
|
|
3
|
+
def self.config(&block)
|
|
4
|
+
@configuration ||= Configuration.new
|
|
5
|
+
unless block.nil?
|
|
6
|
+
yield @configuration
|
|
7
|
+
else
|
|
8
|
+
@configuration.config
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class Configuration
|
|
13
|
+
attr_accessor :url, :user, :password, :api_id
|
|
14
|
+
def config
|
|
15
|
+
{:url => @url,
|
|
16
|
+
:user => @user,
|
|
17
|
+
:password => @password,
|
|
18
|
+
:api_id => @api_id}
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
module Clickatellsend
|
|
2
|
+
|
|
2
3
|
class Request
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
@url = Clickatellsend.config
|
|
6
|
-
@user = Clickatellsend.config
|
|
7
|
-
@password = Clickatellsend.config
|
|
8
|
-
@api_id = Clickatellsend.config
|
|
5
|
+
def initialize()
|
|
6
|
+
@url = Clickatellsend.config[:url]
|
|
7
|
+
@user = Clickatellsend.config[:user]
|
|
8
|
+
@password = Clickatellsend.config[:password]
|
|
9
|
+
@api_id = Clickatellsend.config[:api_id]
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
# :to, :text, :deliv_time
|
|
@@ -58,14 +59,15 @@ module Clickatellsend
|
|
|
58
59
|
|
|
59
60
|
def response(request)
|
|
60
61
|
if request.code == 200
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
response = request.split("\n").map{|l| l.scan /(\w+):\s($|[\w, \d.]+)(?:\s|$)/}.map &:to_h
|
|
63
|
+
if response.size == 1
|
|
64
|
+
response[0]
|
|
65
|
+
end
|
|
65
66
|
else
|
|
66
67
|
{:ERR => "Could not connect to the API, double check your settings and internet connection"}
|
|
67
68
|
end
|
|
68
69
|
end
|
|
69
70
|
|
|
70
71
|
end
|
|
72
|
+
|
|
71
73
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: clickatellsend
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- xploshioOn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-06-
|
|
11
|
+
date: 2016-06-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rest-client
|
|
@@ -42,6 +42,7 @@ files:
|
|
|
42
42
|
- bin/setup
|
|
43
43
|
- clickatellsend.gemspec
|
|
44
44
|
- lib/clickatellsend.rb
|
|
45
|
+
- lib/clickatellsend/clickatell_config.rb
|
|
45
46
|
- lib/clickatellsend/clickatell_request.rb
|
|
46
47
|
- lib/clickatellsend/version.rb
|
|
47
48
|
homepage: https://github.com/xploshioOn/clickatellsend
|
|
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
64
65
|
version: '0'
|
|
65
66
|
requirements: []
|
|
66
67
|
rubyforge_project:
|
|
67
|
-
rubygems_version: 2.
|
|
68
|
+
rubygems_version: 2.4.8
|
|
68
69
|
signing_key:
|
|
69
70
|
specification_version: 4
|
|
70
71
|
summary: Gem to work with Clickatell SMS Gateway API
|