skuby 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -19
- data/.rspec +1 -1
- data/.rubocop.yml +31 -0
- data/.travis.yml +5 -5
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/LICENSE.txt +17 -18
- data/README.md +1 -2
- data/Rakefile +2 -5
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/skuby.rb +1 -4
- data/lib/skuby/configuration.rb +9 -12
- data/lib/skuby/credit.rb +2 -4
- data/lib/skuby/gateway.rb +2 -3
- data/lib/skuby/report.rb +2 -4
- data/lib/skuby/sms_response.rb +1 -3
- data/lib/skuby/version.rb +1 -1
- data/skuby.gemspec +13 -14
- metadata +37 -115
- data/spec/credit_spec.rb +0 -33
- data/spec/fixtures/skebby_report/delivered.yaml +0 -10
- data/spec/fixtures/skebby_report/error.yaml +0 -10
- data/spec/fixtures/vcr_cassettes/get_credit.yml +0 -30
- data/spec/fixtures/vcr_cassettes/get_credit_wrong_credentials.yml +0 -30
- data/spec/fixtures/vcr_cassettes/send_sms_basic.yml +0 -30
- data/spec/fixtures/vcr_cassettes/send_sms_classic.yml +0 -30
- data/spec/fixtures/vcr_cassettes/send_sms_classic_report.yml +0 -30
- data/spec/fixtures/vcr_cassettes/send_sms_no_recipient.yml +0 -30
- data/spec/fixtures/vcr_cassettes/send_sms_wrong_credentials.yml +0 -30
- data/spec/gateway_spec.rb +0 -92
- data/spec/report_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6fd72285ed57dc2b3e23062ba893000fe34f9d4
|
4
|
+
data.tar.gz: 685d86225c73495159e0758c95f7da032ae3fe18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36a4544d1dd8470f6f8be225dc72e83204967c165fafca88decb5e88878ffa83ed105d998615120deccf1646e8765f49d8787140e8ba2b1d21b01eb33f36e8cc
|
7
|
+
data.tar.gz: 4afbf5571ab2cf427e11396a6ecd8071e0af2bee68bbdfbbf9cfd15445779763316e7a376b01a0e80a8297d3b15a23484ca7bcbffbe9c06ae790e48f81599461
|
data/.gitignore
CHANGED
@@ -1,19 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
coverage
|
12
|
-
doc/
|
13
|
-
lib/bundler/man
|
14
|
-
pkg
|
15
|
-
rdoc
|
16
|
-
spec/reports
|
17
|
-
test/tmp
|
18
|
-
test/version_tmp
|
19
|
-
tmp
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/spec/examples.txt
|
10
|
+
/tmp/
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--color
|
2
|
-
--
|
2
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Rails:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 2.3
|
6
|
+
DisplayCopNames: true
|
7
|
+
DisplayStyleGuide: true
|
8
|
+
|
9
|
+
Exclude:
|
10
|
+
- 'bin/*'
|
11
|
+
|
12
|
+
Metrics/LineLength:
|
13
|
+
Max: 100
|
14
|
+
|
15
|
+
# Metrics/MethodLength:
|
16
|
+
# Max: 20
|
17
|
+
|
18
|
+
# Metrics/ClassLength:
|
19
|
+
# Max: 200
|
20
|
+
|
21
|
+
# Metrics/CyclomaticComplexity:
|
22
|
+
# Max: 10
|
23
|
+
|
24
|
+
Style/StringLiterals:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/Documentation:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/FrozenStringLiteralComment:
|
31
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at fabrizio.monti@welaika.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2013 weLaika
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
12
11
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
15
14
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# Skuby
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/welaika/skuby.png?branch=master)](https://travis-ci.org/welaika/skuby)
|
4
|
-
[![Coverage Status](https://coveralls.io/repos/welaika/skuby/badge.png)](https://coveralls.io/r/welaika/skuby)
|
5
4
|
[![Code Climate](https://codeclimate.com/github/welaika/skuby.png)](https://codeclimate.com/github/welaika/skuby)
|
6
|
-
[![Dependency Status](https://gemnasium.com/welaika/skuby.png)](https://gemnasium.com/welaika/skuby)
|
7
5
|
|
8
6
|
A Ruby interface for Skebby
|
9
7
|
Allows you to send SMS through Skebby SMS Gateway.
|
@@ -32,6 +30,7 @@ Or install it yourself as:
|
|
32
30
|
config.password = 'password'
|
33
31
|
config.sender_string = 'company' #optional
|
34
32
|
config.sender_number = '39329900000' #optional
|
33
|
+
config.charset = 'UTF-8' #skebby default is ISO-8859-1
|
35
34
|
end
|
36
35
|
|
37
36
|
Put these lines in `config/environments/production.rb` if you are using Skuby in Rails.
|
data/Rakefile
CHANGED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "skuby"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/skuby.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'cgi'
|
3
|
-
require 'active_support/core_ext/object'
|
4
3
|
require 'skuby/version'
|
5
4
|
require 'skuby/configuration'
|
6
5
|
require 'skuby/gateway'
|
@@ -9,13 +8,11 @@ require 'skuby/report'
|
|
9
8
|
require 'skuby/credit'
|
10
9
|
|
11
10
|
module Skuby
|
12
|
-
|
13
11
|
def self.setup
|
14
|
-
yield
|
12
|
+
yield config
|
15
13
|
end
|
16
14
|
|
17
15
|
def self.config
|
18
16
|
@config ||= Configuration.new
|
19
17
|
end
|
20
|
-
|
21
18
|
end
|
data/lib/skuby/configuration.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
module Skuby
|
2
2
|
class Configuration
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
]
|
3
|
+
SEND_METHODS = %w(
|
4
|
+
send_sms_basic
|
5
|
+
send_sms_classic
|
6
|
+
send_sms_classic_report
|
7
|
+
test_send_sms_basic
|
8
|
+
test_send_sms_classic
|
9
|
+
test_send_sms_classic_report
|
10
|
+
).freeze
|
12
11
|
|
13
12
|
attr_accessor :username, :password, :method,
|
14
13
|
:sender_number, :sender_string, :charset
|
@@ -18,11 +17,9 @@ module Skuby
|
|
18
17
|
end
|
19
18
|
|
20
19
|
def to_hash
|
21
|
-
instance_variables.
|
20
|
+
instance_variables.each_with_object({}) do |var, result|
|
22
21
|
result[var.to_s.delete("@")] = instance_variable_get(var)
|
23
|
-
result
|
24
22
|
end
|
25
23
|
end
|
26
|
-
|
27
24
|
end
|
28
25
|
end
|
data/lib/skuby/credit.rb
CHANGED
@@ -4,14 +4,12 @@ module Skuby
|
|
4
4
|
base_uri 'https://gateway.skebby.it/api/send/smseasy/advanced/http.php'
|
5
5
|
|
6
6
|
def self.balance
|
7
|
-
response = CGI.parse(post('', body: build_params))
|
7
|
+
response = CGI.parse(post('', body: build_params, verify: false))
|
8
8
|
response["credit_left"].first.to_f if response["status"].first == "success"
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.build_params
|
12
|
-
Skuby.config.to_hash.merge(
|
12
|
+
Skuby.config.to_hash.merge('method' => 'get_credit')
|
13
13
|
end
|
14
|
-
|
15
14
|
end
|
16
15
|
end
|
17
|
-
|
data/lib/skuby/gateway.rb
CHANGED
@@ -5,12 +5,11 @@ module Skuby
|
|
5
5
|
|
6
6
|
def self.send_sms(text = '', recipients = '')
|
7
7
|
params = build_params(text, recipients)
|
8
|
-
SMSResponse.new(
|
8
|
+
SMSResponse.new(post('', body: params, verify: false), text, recipients)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.build_params(text, recipients)
|
12
|
-
Skuby.config.to_hash.merge(
|
12
|
+
Skuby.config.to_hash.merge('text' => text, 'recipients[]' => recipients)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
data/lib/skuby/report.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Skuby
|
2
2
|
class Report
|
3
|
-
|
4
3
|
STATUS_MAPPING = {
|
5
4
|
'DELIVERED' => 'Messaggio consegnato',
|
6
5
|
'EXPIRED' => 'Messaggio scaduto (telefono spento/non raggiungibile)',
|
@@ -8,7 +7,7 @@ module Skuby
|
|
8
7
|
'UNDELIVERABLE' => 'Messaggio non spedito (Vedi sotto variabile error_code)',
|
9
8
|
'UNKNOWN' => 'Errore generico',
|
10
9
|
'REJECTD' => 'Messaggio rifiutato dall\'operatore'
|
11
|
-
}
|
10
|
+
}.freeze
|
12
11
|
|
13
12
|
ERROR_CODES = {
|
14
13
|
1 => 'Consegnato',
|
@@ -32,7 +31,7 @@ module Skuby
|
|
32
31
|
910 => 'Testo troppo lungo',
|
33
32
|
101 => 'Malfunzionamento generico operatore',
|
34
33
|
202 => 'Messaggio rifiutato dall\'operatore'
|
35
|
-
}
|
34
|
+
}.freeze
|
36
35
|
|
37
36
|
attr_reader :raw
|
38
37
|
|
@@ -67,6 +66,5 @@ module Skuby
|
|
67
66
|
def delivered_at
|
68
67
|
Time.parse(@raw["operator_date_time"])
|
69
68
|
end
|
70
|
-
|
71
69
|
end
|
72
70
|
end
|
data/lib/skuby/sms_response.rb
CHANGED
data/lib/skuby/version.rb
CHANGED
data/skuby.gemspec
CHANGED
@@ -8,25 +8,24 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Skuby::VERSION
|
9
9
|
spec.authors = ["Fabrizio Monti", "Filippo Gangi Dino"]
|
10
10
|
spec.email = ["fabrizio.monti@welaika.com", "filippo.gangidino@welaika.com"]
|
11
|
-
|
12
|
-
spec.summary =
|
11
|
+
|
12
|
+
spec.summary = "Allows you to send SMS through Skebby SMS Gateway"
|
13
|
+
spec.description = "A Ruby interface to Skebby"
|
13
14
|
spec.homepage = "https://github.com/welaika/skuby"
|
14
15
|
spec.license = "MIT"
|
15
16
|
|
16
|
-
spec.files
|
17
|
-
|
18
|
-
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
22
|
spec.require_paths = ["lib"]
|
20
23
|
|
21
24
|
spec.add_runtime_dependency "httparty"
|
22
|
-
spec.add_runtime_dependency "activesupport"
|
23
25
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.
|
25
|
-
spec.add_development_dependency "
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "
|
28
|
-
spec.add_development_dependency "
|
29
|
-
spec.add_development_dependency "webmock"
|
30
|
-
spec.add_development_dependency "vcr"
|
31
|
-
spec.add_development_dependency "coveralls"
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
spec.add_development_dependency "webmock", "~> 2.1"
|
30
|
+
spec.add_development_dependency "vcr", "~> 3.0"
|
32
31
|
end
|
metadata
CHANGED
@@ -1,156 +1,100 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skuby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabrizio Monti
|
8
8
|
- Filippo Gangi Dino
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: activesupport
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - '>='
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - '>='
|
25
|
+
- - ">="
|
40
26
|
- !ruby/object:Gem::Version
|
41
27
|
version: '0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: bundler
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
45
31
|
requirements:
|
46
|
-
- - ~>
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '1.3'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '1.3'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: pry-plus
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - '>='
|
32
|
+
- - "~>"
|
61
33
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
34
|
+
version: '1.12'
|
63
35
|
type: :development
|
64
36
|
prerelease: false
|
65
37
|
version_requirements: !ruby/object:Gem::Requirement
|
66
38
|
requirements:
|
67
|
-
- -
|
39
|
+
- - "~>"
|
68
40
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
41
|
+
version: '1.12'
|
70
42
|
- !ruby/object:Gem::Dependency
|
71
43
|
name: rake
|
72
44
|
requirement: !ruby/object:Gem::Requirement
|
73
45
|
requirements:
|
74
|
-
- -
|
46
|
+
- - "~>"
|
75
47
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
48
|
+
version: '10.0'
|
77
49
|
type: :development
|
78
50
|
prerelease: false
|
79
51
|
version_requirements: !ruby/object:Gem::Requirement
|
80
52
|
requirements:
|
81
|
-
- -
|
53
|
+
- - "~>"
|
82
54
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
55
|
+
version: '10.0'
|
84
56
|
- !ruby/object:Gem::Dependency
|
85
57
|
name: rspec
|
86
58
|
requirement: !ruby/object:Gem::Requirement
|
87
59
|
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - '>='
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: mocha
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - '>='
|
60
|
+
- - "~>"
|
103
61
|
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
62
|
+
version: '3.0'
|
105
63
|
type: :development
|
106
64
|
prerelease: false
|
107
65
|
version_requirements: !ruby/object:Gem::Requirement
|
108
66
|
requirements:
|
109
|
-
- -
|
67
|
+
- - "~>"
|
110
68
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
69
|
+
version: '3.0'
|
112
70
|
- !ruby/object:Gem::Dependency
|
113
71
|
name: webmock
|
114
72
|
requirement: !ruby/object:Gem::Requirement
|
115
73
|
requirements:
|
116
|
-
- -
|
74
|
+
- - "~>"
|
117
75
|
- !ruby/object:Gem::Version
|
118
|
-
version: '
|
76
|
+
version: '2.1'
|
119
77
|
type: :development
|
120
78
|
prerelease: false
|
121
79
|
version_requirements: !ruby/object:Gem::Requirement
|
122
80
|
requirements:
|
123
|
-
- -
|
81
|
+
- - "~>"
|
124
82
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
83
|
+
version: '2.1'
|
126
84
|
- !ruby/object:Gem::Dependency
|
127
85
|
name: vcr
|
128
86
|
requirement: !ruby/object:Gem::Requirement
|
129
87
|
requirements:
|
130
|
-
- -
|
88
|
+
- - "~>"
|
131
89
|
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
90
|
+
version: '3.0'
|
133
91
|
type: :development
|
134
92
|
prerelease: false
|
135
93
|
version_requirements: !ruby/object:Gem::Requirement
|
136
94
|
requirements:
|
137
|
-
- -
|
95
|
+
- - "~>"
|
138
96
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
140
|
-
- !ruby/object:Gem::Dependency
|
141
|
-
name: coveralls
|
142
|
-
requirement: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - '>='
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
147
|
-
type: :development
|
148
|
-
prerelease: false
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - '>='
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
97
|
+
version: '3.0'
|
154
98
|
description: A Ruby interface to Skebby
|
155
99
|
email:
|
156
100
|
- fabrizio.monti@welaika.com
|
@@ -159,13 +103,18 @@ executables: []
|
|
159
103
|
extensions: []
|
160
104
|
extra_rdoc_files: []
|
161
105
|
files:
|
162
|
-
- .gitignore
|
163
|
-
- .rspec
|
164
|
-
- .
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".rubocop.yml"
|
109
|
+
- ".travis.yml"
|
110
|
+
- CHANGELOG.md
|
111
|
+
- CODE_OF_CONDUCT.md
|
165
112
|
- Gemfile
|
166
113
|
- LICENSE.txt
|
167
114
|
- README.md
|
168
115
|
- Rakefile
|
116
|
+
- bin/console
|
117
|
+
- bin/setup
|
169
118
|
- lib/skuby.rb
|
170
119
|
- lib/skuby/configuration.rb
|
171
120
|
- lib/skuby/credit.rb
|
@@ -174,19 +123,6 @@ files:
|
|
174
123
|
- lib/skuby/sms_response.rb
|
175
124
|
- lib/skuby/version.rb
|
176
125
|
- skuby.gemspec
|
177
|
-
- spec/credit_spec.rb
|
178
|
-
- spec/fixtures/skebby_report/delivered.yaml
|
179
|
-
- spec/fixtures/skebby_report/error.yaml
|
180
|
-
- spec/fixtures/vcr_cassettes/get_credit.yml
|
181
|
-
- spec/fixtures/vcr_cassettes/get_credit_wrong_credentials.yml
|
182
|
-
- spec/fixtures/vcr_cassettes/send_sms_basic.yml
|
183
|
-
- spec/fixtures/vcr_cassettes/send_sms_classic.yml
|
184
|
-
- spec/fixtures/vcr_cassettes/send_sms_classic_report.yml
|
185
|
-
- spec/fixtures/vcr_cassettes/send_sms_no_recipient.yml
|
186
|
-
- spec/fixtures/vcr_cassettes/send_sms_wrong_credentials.yml
|
187
|
-
- spec/gateway_spec.rb
|
188
|
-
- spec/report_spec.rb
|
189
|
-
- spec/spec_helper.rb
|
190
126
|
homepage: https://github.com/welaika/skuby
|
191
127
|
licenses:
|
192
128
|
- MIT
|
@@ -197,32 +133,18 @@ require_paths:
|
|
197
133
|
- lib
|
198
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
199
135
|
requirements:
|
200
|
-
- -
|
136
|
+
- - ">="
|
201
137
|
- !ruby/object:Gem::Version
|
202
138
|
version: '0'
|
203
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
140
|
requirements:
|
205
|
-
- -
|
141
|
+
- - ">="
|
206
142
|
- !ruby/object:Gem::Version
|
207
143
|
version: '0'
|
208
144
|
requirements: []
|
209
145
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.6.4
|
211
147
|
signing_key:
|
212
148
|
specification_version: 4
|
213
149
|
summary: Allows you to send SMS through Skebby SMS Gateway
|
214
|
-
test_files:
|
215
|
-
- spec/credit_spec.rb
|
216
|
-
- spec/fixtures/skebby_report/delivered.yaml
|
217
|
-
- spec/fixtures/skebby_report/error.yaml
|
218
|
-
- spec/fixtures/vcr_cassettes/get_credit.yml
|
219
|
-
- spec/fixtures/vcr_cassettes/get_credit_wrong_credentials.yml
|
220
|
-
- spec/fixtures/vcr_cassettes/send_sms_basic.yml
|
221
|
-
- spec/fixtures/vcr_cassettes/send_sms_classic.yml
|
222
|
-
- spec/fixtures/vcr_cassettes/send_sms_classic_report.yml
|
223
|
-
- spec/fixtures/vcr_cassettes/send_sms_no_recipient.yml
|
224
|
-
- spec/fixtures/vcr_cassettes/send_sms_wrong_credentials.yml
|
225
|
-
- spec/gateway_spec.rb
|
226
|
-
- spec/report_spec.rb
|
227
|
-
- spec/spec_helper.rb
|
228
|
-
has_rdoc:
|
150
|
+
test_files: []
|
data/spec/credit_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Skuby::Credit do
|
4
|
-
|
5
|
-
before do
|
6
|
-
Skuby.setup do |config|
|
7
|
-
config.username = 'username'
|
8
|
-
config.password = 'password'
|
9
|
-
config.sender_string = 'company'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
context "::balance" do
|
14
|
-
it "returns balance in euro" do
|
15
|
-
VCR.use_cassette('get_credit') do
|
16
|
-
request = Skuby::Credit.balance
|
17
|
-
expect(request).to eq(9.49)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context "with wrong credentials" do
|
22
|
-
before { Skuby.setup do |config| config.password = 'wrong_password' end }
|
23
|
-
|
24
|
-
it "returns nil if something's wrong" do
|
25
|
-
VCR.use_cassette('get_credit_wrong_credentials') do
|
26
|
-
expect(Skuby::Credit.balance).to be_nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
@@ -1,10 +0,0 @@
|
|
1
|
-
---
|
2
|
-
method: notify
|
3
|
-
skebby_dispatch_id: '666'
|
4
|
-
skebby_message_id: '777'
|
5
|
-
recipient: '393471234567'
|
6
|
-
status: DELIVERED
|
7
|
-
error_code: '1'
|
8
|
-
user_reference: '12345'
|
9
|
-
skebby_date_time: Mon, 19 Feb 2012 17:52:01 +0000
|
10
|
-
operator_date_time: Mon, 19 Feb 2012 17:51:01 +0000
|
@@ -1,10 +0,0 @@
|
|
1
|
-
---
|
2
|
-
method: notify
|
3
|
-
skebby_dispatch_id: '444'
|
4
|
-
skebby_message_id: '333'
|
5
|
-
recipient: '393471234567'
|
6
|
-
status: UNDELIVERABLE
|
7
|
-
error_code: '502'
|
8
|
-
user_reference: '12345'
|
9
|
-
skebby_date_time: Mon, 15 Aug 2005 15:52:01 +0000
|
10
|
-
operator_date_time: Mon, 15 Aug 2005 15:51:01 +0000
|
@@ -1,30 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://gateway.skebby.it/api/send/smseasy/advanced/http.php
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: method=get_credit&username=username&password=password&sender_string=company
|
9
|
-
headers: {}
|
10
|
-
response:
|
11
|
-
status:
|
12
|
-
code: 200
|
13
|
-
message: OK
|
14
|
-
headers:
|
15
|
-
Date:
|
16
|
-
- Mon, 11 Nov 2013 11:02:23 GMT
|
17
|
-
Server:
|
18
|
-
- Apache
|
19
|
-
Vary:
|
20
|
-
- Accept-Encoding
|
21
|
-
Content-Length:
|
22
|
-
- '61'
|
23
|
-
Content-Type:
|
24
|
-
- text/html
|
25
|
-
body:
|
26
|
-
encoding: UTF-8
|
27
|
-
string: status=success&credit_left=9.49&classic_sms=148&basic_sms=206
|
28
|
-
http_version:
|
29
|
-
recorded_at: Mon, 11 Nov 2013 11:02:24 GMT
|
30
|
-
recorded_with: VCR 2.7.0
|
@@ -1,30 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://gateway.skebby.it/api/send/smseasy/advanced/http.php
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: method=get_credit&username=username&password=wrong_password&sender_string=company
|
9
|
-
headers: {}
|
10
|
-
response:
|
11
|
-
status:
|
12
|
-
code: 200
|
13
|
-
message: OK
|
14
|
-
headers:
|
15
|
-
Date:
|
16
|
-
- Mon, 11 Nov 2013 11:03:19 GMT
|
17
|
-
Server:
|
18
|
-
- Apache
|
19
|
-
Vary:
|
20
|
-
- Accept-Encoding
|
21
|
-
Content-Length:
|
22
|
-
- '144'
|
23
|
-
Content-Type:
|
24
|
-
- text/html
|
25
|
-
body:
|
26
|
-
encoding: UTF-8
|
27
|
-
string: status=failed&code=21&message=Username+or+password+not+valid%2C+you+cannot+use+your+email+or+phone+number%2C+only+username+is+allowed+on+gateway
|
28
|
-
http_version:
|
29
|
-
recorded_at: Mon, 11 Nov 2013 11:03:19 GMT
|
30
|
-
recorded_with: VCR 2.7.0
|
@@ -1,30 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://gateway.skebby.it/api/send/smseasy/advanced/http.php
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: method=send_sms_basic&username=username&password=password&sender_string=company&text=Lorem%20ipsum&recipients[]=393290000000
|
9
|
-
headers: {}
|
10
|
-
response:
|
11
|
-
status:
|
12
|
-
code: 200
|
13
|
-
message: OK
|
14
|
-
headers:
|
15
|
-
Date:
|
16
|
-
- Mon, 11 Nov 2013 10:52:45 GMT
|
17
|
-
Server:
|
18
|
-
- Apache
|
19
|
-
Vary:
|
20
|
-
- Accept-Encoding
|
21
|
-
Content-Length:
|
22
|
-
- '32'
|
23
|
-
Content-Type:
|
24
|
-
- text/html
|
25
|
-
body:
|
26
|
-
encoding: UTF-8
|
27
|
-
string: status=success&remaining_sms=207
|
28
|
-
http_version:
|
29
|
-
recorded_at: Mon, 11 Nov 2013 10:52:45 GMT
|
30
|
-
recorded_with: VCR 2.7.0
|
@@ -1,30 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://gateway.skebby.it/api/send/smseasy/advanced/http.php
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: method=send_sms_classic&username=username&password=password&sender_string=company&text=Lorem%20ipsum&recipients[]=393290000000
|
9
|
-
headers: {}
|
10
|
-
response:
|
11
|
-
status:
|
12
|
-
code: 200
|
13
|
-
message: OK
|
14
|
-
headers:
|
15
|
-
Date:
|
16
|
-
- Mon, 11 Nov 2013 10:50:00 GMT
|
17
|
-
Server:
|
18
|
-
- Apache
|
19
|
-
Vary:
|
20
|
-
- Accept-Encoding
|
21
|
-
Content-Length:
|
22
|
-
- '32'
|
23
|
-
Content-Type:
|
24
|
-
- text/html
|
25
|
-
body:
|
26
|
-
encoding: UTF-8
|
27
|
-
string: status=success&remaining_sms=152
|
28
|
-
http_version:
|
29
|
-
recorded_at: Mon, 11 Nov 2013 10:50:00 GMT
|
30
|
-
recorded_with: VCR 2.7.0
|
@@ -1,30 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://gateway.skebby.it/api/send/smseasy/advanced/http.php
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: method=send_sms_classic_report&username=username&password=password&sender_string=company&text=Lorem%20ipsum&recipients[]=393290000000
|
9
|
-
headers: {}
|
10
|
-
response:
|
11
|
-
status:
|
12
|
-
code: 200
|
13
|
-
message: OK
|
14
|
-
headers:
|
15
|
-
Date:
|
16
|
-
- Mon, 11 Nov 2013 10:51:14 GMT
|
17
|
-
Server:
|
18
|
-
- Apache
|
19
|
-
Vary:
|
20
|
-
- Accept-Encoding
|
21
|
-
Content-Length:
|
22
|
-
- '44'
|
23
|
-
Content-Type:
|
24
|
-
- text/html
|
25
|
-
body:
|
26
|
-
encoding: UTF-8
|
27
|
-
string: status=success&remaining_sms=150&id=64608933
|
28
|
-
http_version:
|
29
|
-
recorded_at: Mon, 11 Nov 2013 10:51:14 GMT
|
30
|
-
recorded_with: VCR 2.7.0
|
@@ -1,30 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://gateway.skebby.it/api/send/smseasy/advanced/http.php
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: method=send_sms_classic_report&username=username&password=password&sender_string=company&text=Lorem%20ipsum&recipients[]=
|
9
|
-
headers: {}
|
10
|
-
response:
|
11
|
-
status:
|
12
|
-
code: 200
|
13
|
-
message: OK
|
14
|
-
headers:
|
15
|
-
Date:
|
16
|
-
- Mon, 11 Nov 2013 10:48:22 GMT
|
17
|
-
Server:
|
18
|
-
- Apache
|
19
|
-
Vary:
|
20
|
-
- Accept-Encoding
|
21
|
-
Content-Length:
|
22
|
-
- '105'
|
23
|
-
Content-Type:
|
24
|
-
- text/html
|
25
|
-
body:
|
26
|
-
encoding: UTF-8
|
27
|
-
string: status=failed&code=25&message=Recipient+not+valid+%28must+be+in+international+format+like+393401234567%29
|
28
|
-
http_version:
|
29
|
-
recorded_at: Mon, 11 Nov 2013 10:48:22 GMT
|
30
|
-
recorded_with: VCR 2.7.0
|
@@ -1,30 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://gateway.skebby.it/api/send/smseasy/advanced/http.php
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: method=send_sms_classic_report&username=username&password=wrong_password&sender_string=company&text=Lorem%20ipsum&recipients[]=393290000000
|
9
|
-
headers: {}
|
10
|
-
response:
|
11
|
-
status:
|
12
|
-
code: 200
|
13
|
-
message: OK
|
14
|
-
headers:
|
15
|
-
Date:
|
16
|
-
- Mon, 11 Nov 2013 10:56:48 GMT
|
17
|
-
Server:
|
18
|
-
- Apache
|
19
|
-
Vary:
|
20
|
-
- Accept-Encoding
|
21
|
-
Content-Length:
|
22
|
-
- '144'
|
23
|
-
Content-Type:
|
24
|
-
- text/html
|
25
|
-
body:
|
26
|
-
encoding: UTF-8
|
27
|
-
string: status=failed&code=21&message=Username+or+password+not+valid%2C+you+cannot+use+your+email+or+phone+number%2C+only+username+is+allowed+on+gateway
|
28
|
-
http_version:
|
29
|
-
recorded_at: Mon, 11 Nov 2013 10:56:48 GMT
|
30
|
-
recorded_with: VCR 2.7.0
|
data/spec/gateway_spec.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Skuby::Gateway do
|
4
|
-
|
5
|
-
before do
|
6
|
-
Skuby.setup do |config|
|
7
|
-
config.username = 'username'
|
8
|
-
config.password = 'password'
|
9
|
-
config.sender_string = 'company'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
context "with send sms classic" do
|
14
|
-
before { Skuby.setup do |config| config.method = 'send_sms_classic' end }
|
15
|
-
|
16
|
-
it "successfully send an sms" do
|
17
|
-
VCR.use_cassette('send_sms_classic') do
|
18
|
-
response = Skuby::Gateway.send_sms('Lorem ipsum', '393290000000')
|
19
|
-
expect(response.success?).to be_true
|
20
|
-
expect(response.sms_id?).to be_false
|
21
|
-
expect(response.remaining_sms).to eq(152)
|
22
|
-
expect(response.text).to eq('Lorem ipsum')
|
23
|
-
expect(response.recipients).to eq(['393290000000'])
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "with send sms basic" do
|
29
|
-
before { Skuby.setup do |config| config.method = 'send_sms_basic' end }
|
30
|
-
|
31
|
-
it "successfully send an sms" do
|
32
|
-
VCR.use_cassette('send_sms_basic') do
|
33
|
-
response = Skuby::Gateway.send_sms('Lorem ipsum', '393290000000')
|
34
|
-
expect(response.success?).to be_true
|
35
|
-
expect(response.sms_id?).to be_false
|
36
|
-
expect(response.remaining_sms).to eq(207)
|
37
|
-
expect(response.text).to eq('Lorem ipsum')
|
38
|
-
expect(response.recipients).to eq(['393290000000'])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "with send sms classic report" do
|
44
|
-
before { Skuby.setup do |config| config.method = 'send_sms_classic_report' end }
|
45
|
-
|
46
|
-
it "successfully send an sms" do
|
47
|
-
VCR.use_cassette('send_sms_classic_report') do
|
48
|
-
response = Skuby::Gateway.send_sms('Lorem ipsum', '393290000000')
|
49
|
-
expect(response.success?).to be_true
|
50
|
-
expect(response.sms_id?).to be_true
|
51
|
-
expect(response.sms_id).to eq('64608933')
|
52
|
-
expect(response.remaining_sms).to eq(150)
|
53
|
-
expect(response.text).to eq('Lorem ipsum')
|
54
|
-
expect(response.recipients).to eq(['393290000000'])
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context "with errors in request" do
|
60
|
-
before { Skuby.setup do |config| config.method = 'send_sms_classic_report' end }
|
61
|
-
|
62
|
-
context "no recipient" do
|
63
|
-
it "returns an error" do
|
64
|
-
VCR.use_cassette('send_sms_no_recipient') do
|
65
|
-
response = Skuby::Gateway.send_sms('Lorem ipsum')
|
66
|
-
expect(response.success?).to be_false
|
67
|
-
expect(response.error_code).to eq(25)
|
68
|
-
expect(response.error_message).to be_present
|
69
|
-
expect(response.text).to eq('Lorem ipsum')
|
70
|
-
expect(response.recipients).to eq([""])
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context "with wrong credentials" do
|
76
|
-
before { Skuby.setup do |config| config.password = 'wrong_password' end }
|
77
|
-
|
78
|
-
it "returns an error" do
|
79
|
-
VCR.use_cassette('send_sms_wrong_credentials') do
|
80
|
-
response = Skuby::Gateway.send_sms('Lorem ipsum', '393290000000')
|
81
|
-
expect(response.success?).to be_false
|
82
|
-
expect(response.error_code).to eq(21)
|
83
|
-
expect(response.error_message).to be_present
|
84
|
-
expect(response.text).to eq('Lorem ipsum')
|
85
|
-
expect(response.recipients).to eq(['393290000000'])
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
data/spec/report_spec.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
describe Skuby::Report do
|
5
|
-
let(:report) { Skuby::Report.new(params) }
|
6
|
-
|
7
|
-
context "with errors" do
|
8
|
-
let(:params) { YAML.load(File.open(fixture_for_skebby_report('error.yaml'))) }
|
9
|
-
|
10
|
-
it "parses skebby response" do
|
11
|
-
expect(report.success?).to be_false
|
12
|
-
expect(report.error_code).to eq(502)
|
13
|
-
expect(report.error_message).to be_present
|
14
|
-
expect(report.message_id).to eq('333')
|
15
|
-
expect(report.dispatch_id).to eq('444')
|
16
|
-
expect(report.delivered_at).to eq(Time.new(2005,8,15,15,51,1,"+00:00"))
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "without errors" do
|
21
|
-
let(:params) { YAML.load(File.open(fixture_for_skebby_report('delivered.yaml'))) }
|
22
|
-
|
23
|
-
it "parses skebby response" do
|
24
|
-
expect(report.success?).to be_true
|
25
|
-
expect(report.message_id).to eq('777')
|
26
|
-
expect(report.dispatch_id).to eq('666')
|
27
|
-
expect(report.delivered_at).to eq(Time.new(2012,2,19,17,51,1,"+00:00"))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def fixture_for_skebby_report(name)
|
32
|
-
File.join(File.dirname(__FILE__), 'fixtures', 'skebby_report', name)
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
data/spec/spec_helper.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'coveralls'
|
2
|
-
Coveralls.wear!
|
3
|
-
|
4
|
-
require 'webmock/rspec'
|
5
|
-
require 'mocha/api'
|
6
|
-
require 'vcr'
|
7
|
-
require 'pry'
|
8
|
-
|
9
|
-
require 'skuby'
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.expect_with :rspec do |c|
|
13
|
-
c.syntax = :expect
|
14
|
-
end
|
15
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
16
|
-
config.run_all_when_everything_filtered = true
|
17
|
-
config.filter_run :focus
|
18
|
-
config.mock_framework = :mocha
|
19
|
-
config.order = 'random'
|
20
|
-
end
|
21
|
-
|
22
|
-
VCR.configure do |c|
|
23
|
-
c.default_cassette_options = { match_requests_on: [:method, :uri, :body] }
|
24
|
-
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
25
|
-
c.hook_into :webmock
|
26
|
-
end
|
27
|
-
|