sageone_api_request_signer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/Fudgefile +25 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +60 -0
- data/Rakefile +2 -0
- data/fudge_settings.yml +5 -0
- data/lib/sageone_api_request_signer.rb +89 -0
- data/lib/sageone_api_request_signer/version.rb +3 -0
- data/sageone_api_request_signer.gemspec +34 -0
- data/spec/integration/check_signature_data_spec.rb +35 -0
- data/spec/sageone_api_request_signer_spec.rb +131 -0
- data/spec/spec_helper.rb +102 -0
- metadata +215 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7c9540bdb219695ef55cca796ef8730f5aec4579
|
4
|
+
data.tar.gz: 2e72ffc0f538e6de181fa8c0ca7f86abdfe8a69e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2da70804fd3c6d4107287fd6b1372ed52f6a26e1ff08bb368469384b65e04889d721bff5e8b000a03f75b979fa629056d408bb8988b9445f7a77561b290eb767
|
7
|
+
data.tar.gz: 9a1f5adb4ec120a922c9e4a734a68f5b7a10b630bf577fca8456fad1c6d3e3543841b207d0a067f7b98801650c389ff2e1eaaa5e78511c0ab3af2c7fe7a71e99
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Fudgefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
exclude = '^\.\/(spec)\/'
|
2
|
+
|
3
|
+
task_group :quality_assurance do
|
4
|
+
cane max_width: 200, exclude: exclude
|
5
|
+
task :flay, exclude: exclude
|
6
|
+
task :flog, exclude: exclude, methods: true
|
7
|
+
end
|
8
|
+
|
9
|
+
task_group :setup_env do
|
10
|
+
clean_bundler_env do
|
11
|
+
shell 'bundle install'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
task_group :rspec do
|
16
|
+
clean_bundler_env do
|
17
|
+
rspec coverage: 100
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
build :default do
|
22
|
+
task_group :setup_env
|
23
|
+
task_group :quality_assurance
|
24
|
+
task_group :rspec
|
25
|
+
end
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Rudiney Altair Franceschi
|
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,60 @@
|
|
1
|
+
# Sageone Api Request Signer
|
2
|
+
|
3
|
+
This gem make the signing process needed to make every request to a [SageOne](http://www.sageone.com) API.
|
4
|
+
|
5
|
+
The signing proccess is described here: [https://developers.sageone.com/docs#signing_your_requests](https://developers.sageone.com/docs#signing_your_requests)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'sageone_api_request_signer'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install sageone_api_request_signer
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
To create the signature string, you need to provide these data:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
@signer = SageoneApiRequestSigner.new({
|
29
|
+
request_method: 'post',
|
30
|
+
url: 'https://api.sageone.com/test/accounts/v1/contacts?config_setting=foo',
|
31
|
+
body_params: {
|
32
|
+
'contact[contact_type_id]' => 1,
|
33
|
+
'contact[name]' => 'My Customer'
|
34
|
+
},
|
35
|
+
signing_secret: 'TestSigningSecret',
|
36
|
+
access_token: 'TestToken',
|
37
|
+
})
|
38
|
+
```
|
39
|
+
|
40
|
+
With the `@signer` you can get the request headers related to the signature part:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
@signer.request_headers
|
44
|
+
=> {
|
45
|
+
=> 'Authorization' => "Bearer #{@signer.access_token}",
|
46
|
+
=> 'X-Nonce' => @signer.nonce,
|
47
|
+
=> 'X-Signature' => @signer.signature,
|
48
|
+
=> }
|
49
|
+
|
50
|
+
```
|
51
|
+
|
52
|
+
You can see a real example here: [Integration test making a real api call to a test endpoint](spec/integration/check_signature_data_spec.rb)
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
1. Fork it ( https://github.com/[my-github-username]/sageone_api_request_signer/fork )
|
57
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
58
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
59
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
60
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/fudge_settings.yml
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require "sageone_api_request_signer/version"
|
2
|
+
require "base64"
|
3
|
+
|
4
|
+
# "Sign" an Sageone API request call following the steps detailed here:
|
5
|
+
# https://developers.sageone.com/docs#signing_your_requests
|
6
|
+
class SageoneApiRequestSigner
|
7
|
+
|
8
|
+
attr_accessor :request_method, :url, :body_params, :nonce, :signing_secret, :access_token
|
9
|
+
|
10
|
+
def initialize(params = {})
|
11
|
+
params.each do |attr, val|
|
12
|
+
self.public_send("#{attr}=", val)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def request_method
|
17
|
+
@request_method.to_s.upcase!
|
18
|
+
end
|
19
|
+
|
20
|
+
def nonce
|
21
|
+
@nonce ||= SecureRandom.hex
|
22
|
+
end
|
23
|
+
|
24
|
+
def uri
|
25
|
+
@uri ||= URI(url)
|
26
|
+
end
|
27
|
+
|
28
|
+
def base_url
|
29
|
+
@base_url ||= [
|
30
|
+
uri.scheme,
|
31
|
+
'://',
|
32
|
+
uri.host,
|
33
|
+
(":#{uri.port}" if uri.port != uri.default_port),
|
34
|
+
uri.path
|
35
|
+
].join
|
36
|
+
end
|
37
|
+
|
38
|
+
def url_params
|
39
|
+
@url_params ||= Hash[URI::decode_www_form(uri.query)]
|
40
|
+
end
|
41
|
+
|
42
|
+
def parameter_string
|
43
|
+
@parameter_string ||= (
|
44
|
+
key_value_pair = percent_encode_pair(url_params.merge(body_params).sort)
|
45
|
+
key_value_pair.map{|pair| pair.join('=') }.join('&')
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def signature_base_string
|
50
|
+
@signature_base_string ||= [
|
51
|
+
request_method,
|
52
|
+
percent_encode(base_url),
|
53
|
+
percent_encode(parameter_string),
|
54
|
+
percent_encode(nonce)
|
55
|
+
].join('&')
|
56
|
+
end
|
57
|
+
|
58
|
+
def signing_key
|
59
|
+
@signing_key ||= [
|
60
|
+
percent_encode(signing_secret),
|
61
|
+
percent_encode(access_token)
|
62
|
+
].join('&')
|
63
|
+
end
|
64
|
+
|
65
|
+
def signature
|
66
|
+
@signature ||= Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), signing_key, signature_base_string))
|
67
|
+
end
|
68
|
+
|
69
|
+
# Just a help to write the signature info on the request headers
|
70
|
+
def request_headers
|
71
|
+
{
|
72
|
+
'Authorization' => "Bearer #{access_token}",
|
73
|
+
'X-Nonce' => nonce,
|
74
|
+
'X-Signature' => signature
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def percent_encode(str)
|
81
|
+
URI.escape(str.to_s, /[^0-9A-Za-z\-._~]/)
|
82
|
+
end
|
83
|
+
|
84
|
+
def percent_encode_pair(pair)
|
85
|
+
pair.map! do |k,v|
|
86
|
+
[percent_encode(k), percent_encode(v)]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sageone_api_request_signer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sageone_api_request_signer"
|
8
|
+
spec.version = SageoneApiRequestSigner::VERSION
|
9
|
+
spec.authors = ["Rudiney Altair Franceschi"]
|
10
|
+
spec.email = ["rudi.atp@gmail.com"]
|
11
|
+
spec.summary = %q{Sign requests call to SageOne API.}
|
12
|
+
spec.description = %q{Sign requests call to SageOne API.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency 'fudge'
|
24
|
+
spec.add_development_dependency 'pry'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'flay'
|
27
|
+
spec.add_development_dependency 'ruby2ruby' # dependency of flay, which doesn't use a gemspec
|
28
|
+
spec.add_development_dependency 'flog'
|
29
|
+
spec.add_development_dependency 'cane'
|
30
|
+
spec.add_development_dependency 'simplecov'
|
31
|
+
|
32
|
+
spec.add_development_dependency 'rest_client' # integration test do real api calls
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
RSpec.describe SageoneApiRequestSigner do
|
5
|
+
subject do
|
6
|
+
SageoneApiRequestSigner.new({
|
7
|
+
request_method: 'post',
|
8
|
+
url: 'https://api.sageone.com/test/accounts/v1/contacts?config_setting=foo',
|
9
|
+
body_params: {
|
10
|
+
'contact[contact_type_id]' => 1,
|
11
|
+
'contact[name]' => 'My Customer'
|
12
|
+
},
|
13
|
+
signing_secret: 'TestSigningSecret',
|
14
|
+
access_token: 'TestToken',
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'doing a real call to the test endpoint' do
|
19
|
+
it 'should check with the test server data' do
|
20
|
+
headers = subject.request_headers.merge({
|
21
|
+
'Accept' => '*/*',
|
22
|
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
23
|
+
'User-Agent' => 'NPSS'
|
24
|
+
})
|
25
|
+
|
26
|
+
begin
|
27
|
+
RestClient.post subject.url, subject.body_params, headers
|
28
|
+
rescue => e
|
29
|
+
response = JSON.parse(e.response.to_s)
|
30
|
+
raise "#{response['error']}: #{response['error_description']}"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
RSpec.describe SageoneApiRequestSigner do
|
2
|
+
it { expect(subject).to respond_to :request_method }
|
3
|
+
it { expect(subject).to respond_to :url }
|
4
|
+
it { expect(subject).to respond_to :body_params }
|
5
|
+
it { expect(subject).to respond_to :nonce }
|
6
|
+
it { expect(subject).to respond_to :signing_secret }
|
7
|
+
it { expect(subject).to respond_to :access_token }
|
8
|
+
|
9
|
+
it 'should set everything on initialize' do
|
10
|
+
obj = described_class.new(
|
11
|
+
request_method: 'method',
|
12
|
+
url: 'url',
|
13
|
+
body_params: 'body',
|
14
|
+
nonce: 'nonce',
|
15
|
+
signing_secret: 'secret',
|
16
|
+
access_token: 'token',
|
17
|
+
)
|
18
|
+
|
19
|
+
expect(obj.request_method).to eql 'METHOD'
|
20
|
+
expect(obj.url).to eql 'url'
|
21
|
+
expect(obj.body_params).to eql 'body'
|
22
|
+
expect(obj.nonce).to eql 'nonce'
|
23
|
+
expect(obj.signing_secret).to eql 'secret'
|
24
|
+
expect(obj.access_token).to eql 'token'
|
25
|
+
end
|
26
|
+
|
27
|
+
subject do
|
28
|
+
described_class.new(
|
29
|
+
request_method: 'post',
|
30
|
+
url: 'https://api.sageone.com/accounts/v1/contacts?config_setting=foo',
|
31
|
+
nonce: 'd6657d14f6d3d9de453ff4b0dc686c6d',
|
32
|
+
body_params: {
|
33
|
+
'contact[contact_type_id]' => 1,
|
34
|
+
'contact[name]' => 'My Customer',
|
35
|
+
}
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#nonce' do
|
40
|
+
it 'should build a rondom one by default' do
|
41
|
+
expect(SecureRandom).to receive(:hex).once.and_return('random nonce')
|
42
|
+
obj = described_class.new
|
43
|
+
|
44
|
+
expect(obj.nonce).to eql 'random nonce'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#uri' do
|
49
|
+
it 'should be an URI with the URL' do
|
50
|
+
subject.url = 'http://www.google.com.br'
|
51
|
+
expect(subject.uri).to eql URI('http://www.google.com.br')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#base_url' do
|
56
|
+
describe 'using the default port' do
|
57
|
+
before { subject.url = 'https://api.sageone.com/accounts/v1/contacts?config_setting=foo' }
|
58
|
+
it { expect(subject.base_url).to eql 'https://api.sageone.com/accounts/v1/contacts' }
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'with a specific port' do
|
62
|
+
before { subject.url = 'https://api.sageone.com:123/accounts/v1/contacts?config_setting=foo' }
|
63
|
+
it { expect(subject.base_url).to eql 'https://api.sageone.com:123/accounts/v1/contacts' }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#url_params' do
|
68
|
+
it 'should give me a has from the url query' do
|
69
|
+
subject.url = 'https://api.sageone.com/accounts/v1/contacts?response_type=code&client_id=4b64axxxxxxxxxx00710&scope=full_access'
|
70
|
+
|
71
|
+
expect(subject.url_params).to eql({
|
72
|
+
'response_type' => 'code',
|
73
|
+
'client_id' => '4b64axxxxxxxxxx00710',
|
74
|
+
'scope' => 'full_access'
|
75
|
+
})
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#parameter_string' do
|
80
|
+
it 'should match the website example' do
|
81
|
+
subject.url = 'https://api.sageone.com/accounts/v1/contacts?config_setting=foo'
|
82
|
+
subject.body_params = {
|
83
|
+
'contact[contact_type_id]' => 1,
|
84
|
+
'contact[name]' => 'My Customer',
|
85
|
+
}
|
86
|
+
|
87
|
+
expect(subject.parameter_string).to eql 'config_setting=foo&contact%5Bcontact_type_id%5D=1&contact%5Bname%5D=My%20Customer'
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should sort the params' do
|
91
|
+
subject.url = 'https://api.sageone.com/accounts/v1/contacts?zee=4&bee=2'
|
92
|
+
subject.body_params = {
|
93
|
+
'aaa' => 1,
|
94
|
+
'dee' => 3,
|
95
|
+
}
|
96
|
+
|
97
|
+
expect(subject.parameter_string).to eql 'aaa=1&bee=2&dee=3&zee=4'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '#signature_base_string' do
|
102
|
+
it 'should follow the website example' do
|
103
|
+
expect(subject.signature_base_string).to eql 'POST&https%3A%2F%2Fapi.sageone.com%2Faccounts%2Fv1%2Fcontacts&config_setting%3Dfoo%26contact%255Bcontact_type_id%255D%3D1%26contact%255Bname%255D%3DMy%2520Customer&d6657d14f6d3d9de453ff4b0dc686c6d'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe '#signing_key' do
|
108
|
+
it 'should be the secret & token percent encoded' do
|
109
|
+
subject.signing_secret = '297850d556xxxxxxxxxxxxxxxxxxxxe722db1d2a'
|
110
|
+
subject.access_token = 'cULSIjxxxxxIhbgbjX0R6MkKO'
|
111
|
+
expect(subject.signing_key).to eql '297850d556xxxxxxxxxxxxxxxxxxxxe722db1d2a&cULSIjxxxxxIhbgbjX0R6MkKO'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe '#signature' do
|
116
|
+
it 'should hash this way' do
|
117
|
+
expected = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), subject.signing_key, subject.signature_base_string))
|
118
|
+
expect(subject.signature).to eql expected
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe '#request_headers' do
|
123
|
+
it 'should help write the request headers' do
|
124
|
+
expect(subject.request_headers).to eql({
|
125
|
+
'Authorization' => "Bearer #{subject.access_token}",
|
126
|
+
'X-Nonce' => subject.nonce,
|
127
|
+
'X-Signature' => subject.signature
|
128
|
+
})
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter 'spec/'
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'sageone_api_request_signer'
|
9
|
+
|
10
|
+
#-----
|
11
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
12
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
13
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
14
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
15
|
+
#
|
16
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
17
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
18
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
19
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
20
|
+
# a separate helper file that requires the additional dependencies and performs
|
21
|
+
# the additional setup, and require it from the spec files that actually need it.
|
22
|
+
#
|
23
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
24
|
+
# users commonly want.
|
25
|
+
#
|
26
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
27
|
+
RSpec.configure do |config|
|
28
|
+
# rspec-expectations config goes here. You can use an alternate
|
29
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
30
|
+
# assertions if you prefer.
|
31
|
+
config.expect_with :rspec do |expectations|
|
32
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
33
|
+
# and `failure_message` of custom matchers include text for helper methods
|
34
|
+
# defined using `chain`, e.g.:
|
35
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
36
|
+
# # => "be bigger than 2 and smaller than 4"
|
37
|
+
# ...rather than:
|
38
|
+
# # => "be bigger than 2"
|
39
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
43
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
44
|
+
config.mock_with :rspec do |mocks|
|
45
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
46
|
+
# a real object. This is generally recommended, and will default to
|
47
|
+
# `true` in RSpec 4.
|
48
|
+
mocks.verify_partial_doubles = true
|
49
|
+
end
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
52
|
+
# For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
# The settings below are suggested to provide a good initial experience
|
61
|
+
# with RSpec, but feel free to customize to your heart's content.
|
62
|
+
=begin
|
63
|
+
# These two settings work together to allow you to limit a spec run
|
64
|
+
# to individual examples or groups you care about by tagging them with
|
65
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
66
|
+
# get run.
|
67
|
+
config.filter_run :focus
|
68
|
+
config.run_all_when_everything_filtered = true
|
69
|
+
|
70
|
+
|
71
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
72
|
+
# be too noisy due to issues in dependencies.
|
73
|
+
config.warnings = true
|
74
|
+
|
75
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
76
|
+
# file, and it's useful to allow more verbose output when running an
|
77
|
+
# individual spec file.
|
78
|
+
if config.files_to_run.one?
|
79
|
+
# Use the documentation formatter for detailed output,
|
80
|
+
# unless a formatter has already been configured
|
81
|
+
# (e.g. via a command-line flag).
|
82
|
+
config.default_formatter = 'doc'
|
83
|
+
end
|
84
|
+
|
85
|
+
# Print the 10 slowest examples and example groups at the
|
86
|
+
# end of the spec run, to help surface which specs are running
|
87
|
+
# particularly slow.
|
88
|
+
config.profile_examples = 10
|
89
|
+
|
90
|
+
# Run specs in random order to surface order dependencies. If you find an
|
91
|
+
# order dependency and want to debug it, you can fix the order by providing
|
92
|
+
# the seed, which is printed after each run.
|
93
|
+
# --seed 1234
|
94
|
+
config.order = :random
|
95
|
+
|
96
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
97
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
98
|
+
# test failures related to randomization by passing the same `--seed` value
|
99
|
+
# as the one that triggered the failure.
|
100
|
+
Kernel.srand config.seed
|
101
|
+
=end
|
102
|
+
end
|
metadata
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sageone_api_request_signer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rudiney Altair Franceschi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fudge
|
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: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: flay
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: ruby2ruby
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: flog
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: cane
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rest_client
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: Sign requests call to SageOne API.
|
168
|
+
email:
|
169
|
+
- rudi.atp@gmail.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".gitignore"
|
175
|
+
- ".rspec"
|
176
|
+
- Fudgefile
|
177
|
+
- Gemfile
|
178
|
+
- LICENSE.txt
|
179
|
+
- README.md
|
180
|
+
- Rakefile
|
181
|
+
- fudge_settings.yml
|
182
|
+
- lib/sageone_api_request_signer.rb
|
183
|
+
- lib/sageone_api_request_signer/version.rb
|
184
|
+
- sageone_api_request_signer.gemspec
|
185
|
+
- spec/integration/check_signature_data_spec.rb
|
186
|
+
- spec/sageone_api_request_signer_spec.rb
|
187
|
+
- spec/spec_helper.rb
|
188
|
+
homepage: ''
|
189
|
+
licenses:
|
190
|
+
- MIT
|
191
|
+
metadata: {}
|
192
|
+
post_install_message:
|
193
|
+
rdoc_options: []
|
194
|
+
require_paths:
|
195
|
+
- lib
|
196
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
requirements: []
|
207
|
+
rubyforge_project:
|
208
|
+
rubygems_version: 2.2.2
|
209
|
+
signing_key:
|
210
|
+
specification_version: 4
|
211
|
+
summary: Sign requests call to SageOne API.
|
212
|
+
test_files:
|
213
|
+
- spec/integration/check_signature_data_spec.rb
|
214
|
+
- spec/sageone_api_request_signer_spec.rb
|
215
|
+
- spec/spec_helper.rb
|