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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9bed0b8b1c4d9eb83f4daeec609fd03466e7e3fb
4
- data.tar.gz: 222e2ffab0b0f069527ef4ddf7a89e0b1e4c53b4
3
+ metadata.gz: 869e385d3f11ff650e1f065a32b0cf8c8ca21ee8
4
+ data.tar.gz: faacb975021d65e5265b223f1f21f2dfeea3bbc4
5
5
  SHA512:
6
- metadata.gz: c8229e25a64651cbebb0ea5ad21482eb3159d5364e7ef0020661b424010e25b08e2153b59752818044eee03da847840fd72bd3a10194e981ec679d290c99cc94
7
- data.tar.gz: 3bb4c85d00755327d75dfd2d2dbc6d24b4c79e9134fc0862f81f225adef6595c4cd7a1aa9ced6eeb8af7fbbbeb48867aa5be4d5de601e48d1049ea1f17390e84
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
- then run the generator:
23
+ ## Configuration
24
24
 
25
- $ rails g clickatellsend
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 | config |
31
- config.clickatell_url
32
- config.clickatell_user
33
- config.clickatell_password
34
- config.clickatell_api_id
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
 
@@ -1,4 +1,5 @@
1
1
  require "clickatellsend/version"
2
2
  require "rest-client"
3
3
 
4
+ require "clickatellsend/clickatell_config"
4
5
  require "clickatellsend/clickatell_request"
@@ -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
- def initialize()
5
- @url = Clickatellsend.config.clickatell_url
6
- @user = Clickatellsend.config.clickatell_user
7
- @password = Clickatellsend.config.clickatell_password
8
- @api_id = Clickatellsend.config.clickatell_api_id
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
- response = request.split("\n").map{|l| l.scan /(\w+):\s($|[\w, \d.]+)(?:\s|$)/}.map &:to_h
62
- if response.size == 1
63
- response[0]
64
- end
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
@@ -1,3 +1,3 @@
1
1
  module Clickatellsend
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  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.0
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-29 00:00:00.000000000 Z
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.5.1
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