sms-club 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +70 -0
- data/LICENSE.txt +22 -0
- data/README.md +66 -0
- data/Rakefile +2 -0
- data/lib/sms-club.rb +5 -0
- data/lib/sms-club/async.rb +31 -0
- data/lib/sms-club/client.rb +95 -0
- data/lib/sms-club/errors.rb +3 -0
- data/lib/sms-club/version.rb +5 -0
- data/sms-club.gemspec +29 -0
- data/spec/async_client_spec.rb +25 -0
- data/spec/client_spec.rb +75 -0
- data/spec/fixtures/xmlgetsmsstatepost.xml +15 -0
- data/spec/fixtures/xmlsendsmspost.failed.xml +10 -0
- data/spec/fixtures/xmlsendsmspost.xml +10 -0
- data/spec/spec_helper.rb +9 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ee180edc7573462755ea7b9a35023d45d640fc0f
|
4
|
+
data.tar.gz: cf79de88712737db09c92446fe4161786e0b346e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 92ebbc8cfc37d0321a0a34d3a988e8361d7864445b8432f87fae6c32d39959e0a8419369c25cd346362f524146360f922a9e8d443c6e0e181122170e70663bfe
|
7
|
+
data.tar.gz: 537ada97df65a11131ad1ffeb8c0aec5324c326e12b9c44cc570d2f17a7b9d876bef64d54d8dfd1df4fd3f1ced1b702712c704d35e615f0ad0108e64059d9ef1
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sms-club (0.2.1)
|
5
|
+
faraday (~> 0.9)
|
6
|
+
iconv (~> 1.0)
|
7
|
+
nokogiri (~> 1.6)
|
8
|
+
translit (~> 0.1)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.3.6)
|
14
|
+
crack (0.4.2)
|
15
|
+
safe_yaml (~> 1.0.0)
|
16
|
+
diff-lcs (1.2.5)
|
17
|
+
faraday (0.9.0)
|
18
|
+
multipart-post (>= 1.2, < 3)
|
19
|
+
iconv (1.0.4)
|
20
|
+
mini_portile (0.6.0)
|
21
|
+
mono_logger (1.1.0)
|
22
|
+
multi_json (1.10.1)
|
23
|
+
multipart-post (2.0.0)
|
24
|
+
nokogiri (1.6.3.1)
|
25
|
+
mini_portile (= 0.6.0)
|
26
|
+
rack (1.5.2)
|
27
|
+
rack-protection (1.5.3)
|
28
|
+
rack
|
29
|
+
redis (3.1.0)
|
30
|
+
redis-namespace (1.5.1)
|
31
|
+
redis (~> 3.0, >= 3.0.4)
|
32
|
+
resque (1.25.2)
|
33
|
+
mono_logger (~> 1.0)
|
34
|
+
multi_json (~> 1.0)
|
35
|
+
redis-namespace (~> 1.3)
|
36
|
+
sinatra (>= 0.9.2)
|
37
|
+
vegas (~> 0.1.2)
|
38
|
+
rspec (3.0.0)
|
39
|
+
rspec-core (~> 3.0.0)
|
40
|
+
rspec-expectations (~> 3.0.0)
|
41
|
+
rspec-mocks (~> 3.0.0)
|
42
|
+
rspec-core (3.0.4)
|
43
|
+
rspec-support (~> 3.0.0)
|
44
|
+
rspec-expectations (3.0.4)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.0.0)
|
47
|
+
rspec-mocks (3.0.4)
|
48
|
+
rspec-support (~> 3.0.0)
|
49
|
+
rspec-support (3.0.4)
|
50
|
+
safe_yaml (1.0.3)
|
51
|
+
sinatra (1.4.5)
|
52
|
+
rack (~> 1.4)
|
53
|
+
rack-protection (~> 1.4)
|
54
|
+
tilt (~> 1.3, >= 1.3.4)
|
55
|
+
tilt (1.4.1)
|
56
|
+
translit (0.1.5)
|
57
|
+
vegas (0.1.11)
|
58
|
+
rack (>= 1.0.0)
|
59
|
+
webmock (1.18.0)
|
60
|
+
addressable (>= 2.3.6)
|
61
|
+
crack (>= 0.3.2)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
resque
|
68
|
+
rspec (~> 3.0)
|
69
|
+
sms-club!
|
70
|
+
webmock (~> 1.18)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Pavel Dotsulenko
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# SmsClub API Client
|
2
|
+
|
3
|
+
Client for http://smsclub.mobi/ SMS gate. Allows you to send and retrieve status of sent SMS via XML API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'sms-club'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install sms-club
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Create new client first. Constructor accepts your login, password for smsclub.mobi and optional default `from` argument
|
22
|
+
|
23
|
+
```
|
24
|
+
SmsClub::Client.new '380993123123', 'password', from: 'CoolCompany'
|
25
|
+
#=> #<SmsClub::Client:0x000000051f9320 @user_name="380993123123", @password="password", @from="CoolCompany", @transliterate=false>
|
26
|
+
```
|
27
|
+
You can also turn on transliteration option by default
|
28
|
+
|
29
|
+
```
|
30
|
+
client = SmsClub::Client.new '380993123123', 'password', transliterate: true
|
31
|
+
#=> #<SmsClub::Client:0x000000051b14d0 @user_name="380993123123", @password="password", @from=nil, @transliterate=true>
|
32
|
+
```
|
33
|
+
|
34
|
+
Sending SMS to multiple numbers at once
|
35
|
+
|
36
|
+
```
|
37
|
+
client.send 'test', to: ['+380664018206', '+380666018203', '+380666018202']
|
38
|
+
#=> ["ID_1", "ID_2", "ID_N"]
|
39
|
+
|
40
|
+
```
|
41
|
+
|
42
|
+
Send sms to one number
|
43
|
+
```
|
44
|
+
client.send_one 'test', to: '+380666128206'
|
45
|
+
#=> "ID_1"
|
46
|
+
```
|
47
|
+
|
48
|
+
Get status of SMS
|
49
|
+
|
50
|
+
```
|
51
|
+
client.status_for 'ID_1'
|
52
|
+
#=> :delivrd
|
53
|
+
|
54
|
+
client.statuses_for ['ID_1', 'ID_2']
|
55
|
+
#=> { 'ID_1' => :delivrd }, { 'ID_2' => :delivrd }
|
56
|
+
```
|
57
|
+
|
58
|
+
For more info please see original api docs http://smsclub.mobi/en/pages/show/api#xml
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
1. Fork it ( https://github.com/pavel-d/sms-club/fork )
|
63
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
64
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
65
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
66
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/sms-club.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'sms-club'
|
2
|
+
begin
|
3
|
+
require 'resque'
|
4
|
+
rescue LoadError => e
|
5
|
+
raise "You need to install resque to use async sms client"
|
6
|
+
end unless defined?(Resque)
|
7
|
+
|
8
|
+
module SmsClub
|
9
|
+
class AsyncClient < Client
|
10
|
+
attr_accessor :queue
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
@init_args = args
|
14
|
+
@queue = 'sms_club'
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def send_async(message, options = {})
|
19
|
+
begin
|
20
|
+
Resque.enqueue(self, @init_args, message, options)
|
21
|
+
rescue Redis::CannotConnectError => e
|
22
|
+
warn e
|
23
|
+
warn 'Can not connect to redis server. Falling back to synchronous mode.'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.perform(init_args, message, options)
|
28
|
+
client = self.new(init_args).send_many(message, options)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'translit'
|
4
|
+
|
5
|
+
module SmsClub
|
6
|
+
# API documentation http://smsclub.mobi/en/pages/show/api#xml
|
7
|
+
class Client
|
8
|
+
attr_accessor :user_name, :password, :from, :transliterate
|
9
|
+
|
10
|
+
def initialize(user_name, password, from: nil, transliterate: false)
|
11
|
+
@user_name = user_name
|
12
|
+
@password = password
|
13
|
+
@from = from
|
14
|
+
@transliterate = transliterate
|
15
|
+
end
|
16
|
+
|
17
|
+
def send_one(message, options = {})
|
18
|
+
send_many(message, options).first
|
19
|
+
end
|
20
|
+
|
21
|
+
def send_many(message, options = {})
|
22
|
+
fail ArgumentError, 'Recepient is not defined' unless options[:to]
|
23
|
+
|
24
|
+
to = options[:to]
|
25
|
+
to = to.map(&:to_s).join(';') if to.is_a? Array
|
26
|
+
|
27
|
+
message = translit_message message if transliterate || options[:transliterate]
|
28
|
+
msg_from = options[:from] || from
|
29
|
+
|
30
|
+
payload = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
31
|
+
xml.request_sendsms do
|
32
|
+
xml.username { xml.cdata @user_name }
|
33
|
+
xml.password { xml.cdata @password }
|
34
|
+
xml.from { xml.cdata msg_from }
|
35
|
+
xml.to { xml.cdata to }
|
36
|
+
xml.text_ { xml.cdata message }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
response = connection.post '/hfw_smpp_addon/xmlsendsmspost.php', xmlrequest: payload.to_xml
|
41
|
+
doc = Nokogiri::XML(response.body)
|
42
|
+
|
43
|
+
raise SmsClubError, response_error(doc) if response_failed?(doc)
|
44
|
+
|
45
|
+
doc.xpath('//mess').map(&:content)
|
46
|
+
end
|
47
|
+
|
48
|
+
def status_for(smscid)
|
49
|
+
statuses_for(smscid).first[smscid]
|
50
|
+
end
|
51
|
+
|
52
|
+
def statuses_for(smscid)
|
53
|
+
smscid = smscid.map(&:to_s).join(';') if smscid.is_a? Array
|
54
|
+
|
55
|
+
payload = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
56
|
+
xml.request_getstate do
|
57
|
+
xml.username { xml.cdata @user_name }
|
58
|
+
xml.password { xml.cdata @password }
|
59
|
+
xml.smscid { xml.cdata smscid }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
response = connection.post '/hfw_smpp_addon/xmlgetsmsstatepost.php', xmlrequest: payload.to_xml
|
64
|
+
|
65
|
+
doc = Nokogiri::XML(response.body)
|
66
|
+
|
67
|
+
raise SmsClubError, response_error(doc) if response_failed?(doc)
|
68
|
+
|
69
|
+
doc.xpath('//entry').map do |entry|
|
70
|
+
{ entry.xpath('smscid').text => entry.xpath('state').text.downcase.to_sym }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
protected
|
75
|
+
|
76
|
+
def connection
|
77
|
+
@connection ||= Faraday.new(url: 'https://gate.smsclub.mobi/') do |faraday|
|
78
|
+
faraday.request :url_encoded
|
79
|
+
faraday.adapter Faraday.default_adapter
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def translit_message(message)
|
84
|
+
Translit.convert message
|
85
|
+
end
|
86
|
+
|
87
|
+
def response_failed?(xml_doc)
|
88
|
+
xml_doc.xpath('//status').text != 'OK'
|
89
|
+
end
|
90
|
+
|
91
|
+
def response_error(xml_doc)
|
92
|
+
xml_doc.xpath('//text').text
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
data/sms-club.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sms-club/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'sms-club'
|
8
|
+
spec.version = Sms::Club::VERSION
|
9
|
+
spec.authors = ['Pavel Dotsulenko']
|
10
|
+
spec.email = ['paul@live.ru']
|
11
|
+
spec.summary = 'Client for http://smsclub.mobi/ SMS gate'
|
12
|
+
spec.description = 'Client for http://smsclub.mobi/ SMS gate. Allows you to send and retrieve status of sent SMS via XML API. Supports Resque for asynchronous sending.'
|
13
|
+
spec.homepage = 'https://github.com/pavel-d/sms-club'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(/\{^bin\/}/) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(/\{^(test|spec|features)\/}/)
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'webmock', '~> 1.18'
|
22
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
23
|
+
spec.add_development_dependency 'resque'
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'faraday', '~> 0.9'
|
26
|
+
spec.add_runtime_dependency 'translit', '~> 0.1'
|
27
|
+
spec.add_runtime_dependency 'iconv', '~> 1.0'
|
28
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
require 'uri'
|
4
|
+
require 'sms-club/async'
|
5
|
+
require 'resque'
|
6
|
+
|
7
|
+
describe SmsClub::AsyncClient do
|
8
|
+
let(:client) { SmsClub::AsyncClient.new '380993123123', 'password', from: 'KupiChehol' }
|
9
|
+
|
10
|
+
describe '#send' do
|
11
|
+
before do
|
12
|
+
stub_request(:post, 'https://gate.smsclub.mobi/hfw_smpp_addon/xmlsendsmspost.php')
|
13
|
+
.to_return(status: 200, body: File.open('./spec/fixtures/xmlsendsmspost.xml'), headers: {})
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should send sms asynchronously' do
|
17
|
+
client.send_async 'test', to: '+380666128206'
|
18
|
+
end
|
19
|
+
it 'should fallback to synchronous mode' do
|
20
|
+
Resque.redis = Redis.new(host: 'localhost', port: 9999)
|
21
|
+
client.send_async 'test', to: '+380666128206'
|
22
|
+
Resque.redis = Redis.new(host: 'localhost', port: 6379)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/client_spec.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
require 'uri'
|
4
|
+
require 'sms-club/async'
|
5
|
+
|
6
|
+
describe SmsClub::Client do
|
7
|
+
let(:client) { SmsClub::Client.new '380993123123', 'password', from: 'KupiChehol' }
|
8
|
+
|
9
|
+
describe '#send' do
|
10
|
+
before do
|
11
|
+
stub_request(:post, 'https://gate.smsclub.mobi/hfw_smpp_addon/xmlsendsmspost.php')
|
12
|
+
.to_return(status: 200, body: File.open('./spec/fixtures/xmlsendsmspost.xml'), headers: {})
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should send message one recipient' do
|
16
|
+
result = client.send_one 'test', to: '+380666128206'
|
17
|
+
|
18
|
+
expect(result).to be_a String
|
19
|
+
expect(result).to eq 'ID_1'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should send messages to multiple recipients' do
|
23
|
+
result = client.send_many'test', to: ['+380664018206', '+380666018203', '+380666018202']
|
24
|
+
|
25
|
+
expect(result).to be_an Array
|
26
|
+
expect(result.length).to eq 3
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'an POST HTTP request' do
|
30
|
+
it 'should include phone number' do
|
31
|
+
client.send_one 'test', to: '+380666128206'
|
32
|
+
|
33
|
+
expect(a_request(:post, 'https://gate.smsclub.mobi/hfw_smpp_addon/xmlsendsmspost.php')
|
34
|
+
.with { |req| URI.decode(req.body) =~ /\+380666128206/ })
|
35
|
+
.to have_been_made
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should include multiple phone numbers' do
|
39
|
+
client.send_many'test', to: ['+380664018206', '+380666018203', '+380666018202']
|
40
|
+
|
41
|
+
expect(a_request(:post, 'https://gate.smsclub.mobi/hfw_smpp_addon/xmlsendsmspost.php')
|
42
|
+
.with { |req| URI.decode(req.body) =~ /\+380664018206;\+380666018203;\+380666018202/ })
|
43
|
+
.to have_been_made
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should throw error if send failed' do
|
48
|
+
stub_request(:post, 'https://gate.smsclub.mobi/hfw_smpp_addon/xmlsendsmspost.php')
|
49
|
+
.to_return(status: 200, body: File.open('./spec/fixtures/xmlsendsmspost.failed.xml'), headers: {})
|
50
|
+
expect { client.send_many'test', to: ['+380664018206', '+380666018203', '+380666018202'] }.to raise_error
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should transliterate message when tranliterate: true' do
|
54
|
+
client.send_one 'привет', to: '+380666128206', transliterate: true
|
55
|
+
expect(a_request(:post, 'https://gate.smsclub.mobi/hfw_smpp_addon/xmlsendsmspost.php')
|
56
|
+
.with { |req| req.body =~ /privet/ }).to have_been_made
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#status_for' do
|
61
|
+
before do
|
62
|
+
stub_request(:post, 'https://gate.smsclub.mobi/hfw_smpp_addon/xmlgetsmsstatepost.php')
|
63
|
+
.to_return(status: 200, body: File.open('./spec/fixtures/xmlgetsmsstatepost.xml'), headers: {})
|
64
|
+
end
|
65
|
+
it 'should return status symbol' do
|
66
|
+
result = client.status_for 'ID_1'
|
67
|
+
expect(result).to eq :delivrd
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should return hash of message statuses' do
|
71
|
+
result = client.statuses_for ['ID_1', 'ID_2']
|
72
|
+
expect(result).to eq [{ 'ID_1' => :delivrd }, { 'ID_2' => :delivrd }]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<response>
|
3
|
+
<status>OK</status>
|
4
|
+
<text></text>
|
5
|
+
<entries>
|
6
|
+
<entry>
|
7
|
+
<smscid>ID_1</smscid>
|
8
|
+
<state>delivrd</state>
|
9
|
+
</entry>
|
10
|
+
<entry>
|
11
|
+
<smscid>ID_2</smscid>
|
12
|
+
<state>delivrd</state>
|
13
|
+
</entry>
|
14
|
+
</entries>
|
15
|
+
</response>
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sms-club
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pavel Dotsulenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: webmock
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.18'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.18'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: resque
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: translit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: iconv
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: nokogiri
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.6'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.6'
|
111
|
+
description: Client for http://smsclub.mobi/ SMS gate. Allows you to send and retrieve
|
112
|
+
status of sent SMS via XML API. Supports Resque for asynchronous sending.
|
113
|
+
email:
|
114
|
+
- paul@live.ru
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- Gemfile
|
121
|
+
- Gemfile.lock
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- lib/sms-club.rb
|
126
|
+
- lib/sms-club/async.rb
|
127
|
+
- lib/sms-club/client.rb
|
128
|
+
- lib/sms-club/errors.rb
|
129
|
+
- lib/sms-club/version.rb
|
130
|
+
- sms-club.gemspec
|
131
|
+
- spec/async_client_spec.rb
|
132
|
+
- spec/client_spec.rb
|
133
|
+
- spec/fixtures/xmlgetsmsstatepost.xml
|
134
|
+
- spec/fixtures/xmlsendsmspost.failed.xml
|
135
|
+
- spec/fixtures/xmlsendsmspost.xml
|
136
|
+
- spec/spec_helper.rb
|
137
|
+
homepage: https://github.com/pavel-d/sms-club
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
metadata: {}
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
requirements: []
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 2.2.2
|
158
|
+
signing_key:
|
159
|
+
specification_version: 4
|
160
|
+
summary: Client for http://smsclub.mobi/ SMS gate
|
161
|
+
test_files: []
|