cloudhdr 0.0.2 → 0.0.3
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 +5 -5
- data/.gitignore +2 -1
- data/.ruby-version +1 -0
- data/Gemfile.lock +64 -0
- data/cloudhdr.gemspec +1 -3
- data/lib/cloudhdr/version.rb +1 -1
- data/spec/cloudhdr/http/net_http_spec.rb +3 -3
- data/spec/cloudhdr/http_spec.rb +15 -15
- data/spec/cloudhdr/job_spec.rb +3 -3
- data/spec/cloudhdr/response_spec.rb +5 -5
- metadata +10 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e2359bd3a33657788d742e38b5bf4d18bd8c27a325d43a13edb4dcfac928aac9
|
4
|
+
data.tar.gz: 25a13f8915886660b709748e7f09c19637ac89fb7dc6a845a746979ae5525df8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b7bc04cdfd444fdd7174b7fefa9431f84a758d7c4a1a28ca54d8dae4e8e42a306fcf76ccbd430724687e8acb69d5f6743b99e6c0dad3d82799d1878b06f8f7
|
7
|
+
data.tar.gz: e8e510d96b3edff919833103ae3a421d0cd7e2749fba330244925aed6572a828445237e8da2a31dd039b38d82ae5048212ac04a2869b74bfd6b4c481a33e4952
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.7
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cloudhdr (0.0.3)
|
5
|
+
activesupport (> 3.0.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (7.1.4)
|
11
|
+
base64
|
12
|
+
bigdecimal
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
connection_pool (>= 2.2.5)
|
15
|
+
drb
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
mutex_m
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
addressable (2.8.7)
|
21
|
+
public_suffix (>= 2.0.2, < 7.0)
|
22
|
+
base64 (0.2.0)
|
23
|
+
bigdecimal (3.1.8)
|
24
|
+
builder (3.2.0)
|
25
|
+
concurrent-ruby (1.3.4)
|
26
|
+
connection_pool (2.4.1)
|
27
|
+
crack (1.0.0)
|
28
|
+
bigdecimal
|
29
|
+
rexml
|
30
|
+
diff-lcs (1.5.1)
|
31
|
+
drb (2.2.1)
|
32
|
+
i18n (1.14.6)
|
33
|
+
concurrent-ruby (~> 1.0)
|
34
|
+
minitest (5.25.1)
|
35
|
+
mutex_m (0.2.0)
|
36
|
+
public_suffix (6.0.1)
|
37
|
+
rake (10.0.4)
|
38
|
+
rexml (3.3.8)
|
39
|
+
rspec (2.99.0)
|
40
|
+
rspec-core (~> 2.99.0)
|
41
|
+
rspec-expectations (~> 2.99.0)
|
42
|
+
rspec-mocks (~> 2.99.0)
|
43
|
+
rspec-core (2.99.2)
|
44
|
+
rspec-expectations (2.99.2)
|
45
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
46
|
+
rspec-mocks (2.99.4)
|
47
|
+
tzinfo (2.0.6)
|
48
|
+
concurrent-ruby (~> 1.0)
|
49
|
+
webmock (1.11.0)
|
50
|
+
addressable (>= 2.2.7)
|
51
|
+
crack (>= 0.3.2)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
builder (~> 3.2.0)
|
58
|
+
cloudhdr!
|
59
|
+
rake
|
60
|
+
rspec (~> 2.0)
|
61
|
+
webmock (~> 1.11.0)
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
2.2.33
|
data/cloudhdr.gemspec
CHANGED
@@ -19,10 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "activesupport", "> 3.0.0"
|
22
|
-
spec.add_dependency "json", "~> 1.8.0"
|
23
22
|
|
24
|
-
spec.add_development_dependency "
|
25
|
-
spec.add_development_dependency "rspec", "~> 2.13.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 2.0"
|
26
24
|
spec.add_development_dependency "webmock", "~> 1.11.0"
|
27
25
|
#spec.add_development_dependency "mocha", "~> 0.14.0"
|
28
26
|
spec.add_development_dependency "builder", "~> 3.2.0"
|
data/lib/cloudhdr/version.rb
CHANGED
@@ -38,7 +38,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
38
38
|
|
39
39
|
describe "SSL verification" do
|
40
40
|
it "should verify when the SSL directory is found" do
|
41
|
-
http_stub =
|
41
|
+
http_stub = double(:use_ssl= => true, :ca_path= => true, :verify_depth= => true, :request => true)
|
42
42
|
http_stub.should_receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_PEER)
|
43
43
|
::Net::HTTP.should_receive(:new).and_return(http_stub)
|
44
44
|
Cloudhdr::HTTP::NetHTTP.any_instance.should_receive(:locate_root_cert_path).and_return('/fake/path')
|
@@ -46,14 +46,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should not verify when set to skip ssl verification" do
|
49
|
-
http_stub =
|
49
|
+
http_stub = double(:use_ssl= => true, :request => true)
|
50
50
|
http_stub.should_receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_NONE)
|
51
51
|
::Net::HTTP.should_receive(:new).and_return(http_stub)
|
52
52
|
Cloudhdr::HTTP::NetHTTP.post('https://example.com/path', :skip_ssl_verify => true)
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should not verify when the SSL directory is not found" do
|
56
|
-
http_stub =
|
56
|
+
http_stub = double(:use_ssl= => true, :ca_path= => true, :verify_depth= => true, :request => true)
|
57
57
|
http_stub.should_receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_NONE)
|
58
58
|
::Net::HTTP.should_receive(:new).and_return(http_stub)
|
59
59
|
Cloudhdr::HTTP::NetHTTP.any_instance.should_receive(:locate_root_cert_path).and_return(nil)
|
data/spec/cloudhdr/http_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
describe "Cloudhdr::HTTP" do
|
4
4
|
|
5
5
|
it "should have a default_options hash" do
|
6
|
-
Cloudhdr::HTTP.default_options.is_a?(Hash).should
|
6
|
+
Cloudhdr::HTTP.default_options.is_a?(Hash).should be_truthy
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should have a default HTTP backend" do
|
@@ -32,40 +32,40 @@ describe "Cloudhdr::HTTP" do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should return a Cloudhdr::Response" do
|
35
|
-
Cloudhdr::HTTP.http_backend.stub(:post).and_return(
|
36
|
-
Cloudhdr::HTTP.http_backend.stub(:put).and_return(
|
37
|
-
Cloudhdr::HTTP.http_backend.stub(:get).and_return(
|
38
|
-
Cloudhdr::HTTP.http_backend.stub(:delete).and_return(
|
39
|
-
|
40
|
-
Cloudhdr::HTTP.post('https://example.com', '{"some": "hash"}').is_a?(Cloudhdr::Response).should
|
41
|
-
Cloudhdr::HTTP.put('https://example.com', '{"some": "hash"}').is_a?(Cloudhdr::Response).should
|
42
|
-
Cloudhdr::HTTP.get('https://example.com').is_a?(Cloudhdr::Response).should
|
43
|
-
Cloudhdr::HTTP.delete('https://example.com').is_a?(Cloudhdr::Response).should
|
35
|
+
Cloudhdr::HTTP.http_backend.stub(:post).and_return(double(:code => 200, :body => '{"some": "hash"}'))
|
36
|
+
Cloudhdr::HTTP.http_backend.stub(:put).and_return(double(:code => 200, :body => '{"some": "hash"}'))
|
37
|
+
Cloudhdr::HTTP.http_backend.stub(:get).and_return(double(:code => 200, :body => '{"some": "hash"}'))
|
38
|
+
Cloudhdr::HTTP.http_backend.stub(:delete).and_return(double(:code => 200, :body => '{"some": "hash"}'))
|
39
|
+
|
40
|
+
Cloudhdr::HTTP.post('https://example.com', '{"some": "hash"}').is_a?(Cloudhdr::Response).should be_truthy
|
41
|
+
Cloudhdr::HTTP.put('https://example.com', '{"some": "hash"}').is_a?(Cloudhdr::Response).should be_truthy
|
42
|
+
Cloudhdr::HTTP.get('https://example.com').is_a?(Cloudhdr::Response).should be_truthy
|
43
|
+
Cloudhdr::HTTP.delete('https://example.com').is_a?(Cloudhdr::Response).should be_truthy
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should store the raw response" do
|
47
|
-
post_stub =
|
47
|
+
post_stub = double(:code => 200, :body => '{"some": "hash"}')
|
48
48
|
Cloudhdr::HTTP.http_backend.stub(:post).and_return(post_stub)
|
49
49
|
Cloudhdr::HTTP.post('https://example.com', '{"some": "hash"}').raw_response.should == post_stub
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should store the raw response body" do
|
53
|
-
Cloudhdr::HTTP.http_backend.stub(:post).and_return(
|
53
|
+
Cloudhdr::HTTP.http_backend.stub(:post).and_return(double(:code => 200, :body => '{"some": "hash"}'))
|
54
54
|
Cloudhdr::HTTP.post('https://example.com', '{"some": "hash"}').raw_body.should == '{"some": "hash"}'
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should store the response code" do
|
58
|
-
Cloudhdr::HTTP.http_backend.stub(:post).and_return(
|
58
|
+
Cloudhdr::HTTP.http_backend.stub(:post).and_return(double(:code => 200, :body => '{"some": "hash"}'))
|
59
59
|
Cloudhdr::HTTP.post('https://example.com', '{"some": "hash"}').code.should == 200
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should JSON parse the response body" do
|
63
|
-
Cloudhdr::HTTP.http_backend.stub(:put).and_return(
|
63
|
+
Cloudhdr::HTTP.http_backend.stub(:put).and_return(double(:code => 200, :body => '{"some": "hash"}'))
|
64
64
|
Cloudhdr::HTTP.put('https://example.com', '{"some": "hash"}').body.should == {'some' => 'hash'}
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should store the raw body if the body fails to be JSON parsed" do
|
68
|
-
Cloudhdr::HTTP.http_backend.stub(:put).and_return(
|
68
|
+
Cloudhdr::HTTP.http_backend.stub(:put).and_return(double(:code => 200, :body => '{"some": bad json'))
|
69
69
|
Cloudhdr::HTTP.put('https://example.com', '{"some": "hash"}').body.should == '{"some": bad json'
|
70
70
|
end
|
71
71
|
|
data/spec/cloudhdr/job_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe "Cloudhdr::Job" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should apply the global API key when JSON and no api_key is passed" do
|
24
|
-
|
24
|
+
skip "Need to fix"
|
25
25
|
Cloudhdr.api_key = 'asdfasdf'
|
26
26
|
Cloudhdr::HTTP.should_receive(:post).with(@url + ".json",@params_as_json,{}) do |url, params, options|
|
27
27
|
Cloudhdr::Base.decode(params)['api_key'].should == Cloudhdr.api_key
|
@@ -31,7 +31,7 @@ describe "Cloudhdr::Job" do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should apply the global API key when XML and no api_key is passed" do
|
34
|
-
|
34
|
+
skip "Need to fix"
|
35
35
|
Cloudhdr.api_key = 'asdfasdf'
|
36
36
|
Cloudhdr::HTTP.should_receive(:post).with(@url + ".xml",@params_as_xml,{}) do |url, params, options|
|
37
37
|
Cloudhdr::Base.decode(params, :xml)['api_request']['api_key'].should == Cloudhdr.api_key
|
@@ -41,7 +41,7 @@ describe "Cloudhdr::Job" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should apply the global API key when an XML string is passed and no api_key is passed" do
|
44
|
-
|
44
|
+
skip "Need to fix"
|
45
45
|
Cloudhdr.api_key = 'asdfasdf'
|
46
46
|
Cloudhdr::HTTP.should_receive(:post).with(@url + ".json",@params_as_xml,{}) do |url, params, options|
|
47
47
|
Cloudhdr::Base.decode(params, :xml)['api_request']['api_key'] == Cloudhdr.api_key
|
@@ -5,14 +5,14 @@ describe "Cloudhdr::Response" do
|
|
5
5
|
|
6
6
|
describe "#success?" do
|
7
7
|
it "should return true when code is between 200 and 299" do
|
8
|
-
Cloudhdr::Response.new(:code => 200).success?.should
|
9
|
-
Cloudhdr::Response.new(:code => 299).success?.should
|
10
|
-
Cloudhdr::Response.new(:code => 250).success?.should
|
8
|
+
Cloudhdr::Response.new(:code => 200).success?.should be_truthy
|
9
|
+
Cloudhdr::Response.new(:code => 299).success?.should be_truthy
|
10
|
+
Cloudhdr::Response.new(:code => 250).success?.should be_truthy
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should return false when code it less than 200 or greater than 299" do
|
14
|
-
Cloudhdr::Response.new(:code => 300).success?.should_not
|
15
|
-
Cloudhdr::Response.new(:code => 199).success?.should_not
|
14
|
+
Cloudhdr::Response.new(:code => 300).success?.should_not be_truthy
|
15
|
+
Cloudhdr::Response.new(:code => 199).success?.should_not be_truthy
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudhdr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Green
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,48 +24,20 @@ dependencies:
|
|
24
24
|
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.8.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.8.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.3'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.3'
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
28
|
name: rspec
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
31
|
- - "~>"
|
60
32
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.
|
33
|
+
version: '2.0'
|
62
34
|
type: :development
|
63
35
|
prerelease: false
|
64
36
|
version_requirements: !ruby/object:Gem::Requirement
|
65
37
|
requirements:
|
66
38
|
- - "~>"
|
67
39
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.
|
40
|
+
version: '2.0'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
42
|
name: webmock
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +89,9 @@ extra_rdoc_files: []
|
|
117
89
|
files:
|
118
90
|
- ".gitignore"
|
119
91
|
- ".rspec"
|
92
|
+
- ".ruby-version"
|
120
93
|
- Gemfile
|
94
|
+
- Gemfile.lock
|
121
95
|
- LICENSE.txt
|
122
96
|
- README.md
|
123
97
|
- Rakefile
|
@@ -144,7 +118,7 @@ homepage: ''
|
|
144
118
|
licenses:
|
145
119
|
- MIT
|
146
120
|
metadata: {}
|
147
|
-
post_install_message:
|
121
|
+
post_install_message:
|
148
122
|
rdoc_options: []
|
149
123
|
require_paths:
|
150
124
|
- lib
|
@@ -159,9 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
133
|
- !ruby/object:Gem::Version
|
160
134
|
version: '0'
|
161
135
|
requirements: []
|
162
|
-
|
163
|
-
|
164
|
-
signing_key:
|
136
|
+
rubygems_version: 3.2.33
|
137
|
+
signing_key:
|
165
138
|
specification_version: 4
|
166
139
|
summary: Ruby wrapper for the CloudHdr Processing API
|
167
140
|
test_files:
|