shirtsio 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/Gemfile +7 -0
- data/README.md +10 -2
- data/lib/shirtsio/version.rb +1 -1
- data/shirtsio.gemspec +1 -1
- data/spec/quote_spec.rb +1 -1
- data/spec/request_spec.rb +43 -0
- data/spec/spec_helper.rb +7 -1
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e40853e2547de095d7a8406068c48c8e3ea9037
|
4
|
+
data.tar.gz: 775720dd7b1e03e3d1101fa98bb8fd3e08b7e683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3da85063a9b03e5c00683b27dcbd2f4d4dfcd5fe7f7520280216a3383b86d4e609ecb3958b129ffe6737dc53e5d37f4d2ac0d2b15d16bcd86459f732fe0735e8
|
7
|
+
data.tar.gz: fc886cba43cd270220e945ac8b959cce3f6a2bbf54b072a7ddd6d28e3a144e31e890fa2dc7f2cc02e5750005b610db7afb426e431b55afbae22b8d21ce9fcaf9
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -5,11 +5,18 @@ gemspec
|
|
5
5
|
|
6
6
|
platforms :rbx do
|
7
7
|
gem 'json'
|
8
|
+
gem 'psych'
|
9
|
+
gem 'racc'
|
10
|
+
gem 'rubinius-coverage'
|
11
|
+
gem 'rubysl', '~> 2.0'
|
12
|
+
gem 'rubysl-test-unit'
|
8
13
|
end
|
9
14
|
|
10
15
|
group :development do
|
11
16
|
gem 'bundler'
|
17
|
+
gem 'coveralls', :require => false
|
12
18
|
gem 'rake'
|
19
|
+
gem 'webmock'
|
13
20
|
gem 'yard'
|
14
21
|
end
|
15
22
|
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A Ruby wrapper around the shirts.io API
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.org/anthonator/shirtsio.png?branch=master)](https://travis-ci.org/anthonator/shirtsio)
|
5
|
+
[![Build Status](https://travis-ci.org/anthonator/shirtsio.png?branch=master)](https://travis-ci.org/anthonator/shirtsio) [![Code Climate](https://codeclimate.com/github/anthonator/shirtsio.png)](https://codeclimate.com/github/anthonator/shirtsio) [![Coverage Status](https://coveralls.io/repos/anthonator/shirtsio/badge.png?branch=master)](https://coveralls.io/r/anthonator/shirtsio?branch=master)
|
6
6
|
|
7
7
|
## Documentation
|
8
8
|
|
@@ -132,7 +132,7 @@ order = Shirtsio::Order.create do |order|
|
|
132
132
|
address.state 'IN'
|
133
133
|
address.country 'US'
|
134
134
|
address.batch 1
|
135
|
-
address.sizes do |size
|
135
|
+
address.sizes do |size|
|
136
136
|
size.med 1
|
137
137
|
end
|
138
138
|
end
|
@@ -163,3 +163,11 @@ webhooks[0].delete
|
|
163
163
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
164
164
|
4. Push to the branch (`git push origin my-new-feature`)
|
165
165
|
5. Create new Pull Request
|
166
|
+
|
167
|
+
## Credits
|
168
|
+
|
169
|
+
[![Sticksnleaves](http://sticksnleaves-wordpress.herokuapp.com/wp-content/themes/sticksnleaves/images/snl-logo-116x116.png)](http://www.sticksnleaves.com)
|
170
|
+
|
171
|
+
Shirtsio is maintained and funded by [Sticksnleaves](http://www.sticksnleaves.com)
|
172
|
+
|
173
|
+
Thanks to all of our [contributors](https://github.com/anthonator/shirtsio/graphs/contributors)
|
data/lib/shirtsio/version.rb
CHANGED
data/shirtsio.gemspec
CHANGED
data/spec/quote_spec.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Shirtsio::Request do
|
4
|
+
context "GET" do
|
5
|
+
it "should return value on success" do
|
6
|
+
stub_request(:get, /https:\/\/www.shirts.io\/api\/v1\/.*/)
|
7
|
+
.to_return(body: '{ "result": "success" }', status: 200, headers: { 'Content-Type' => 'application/json' })
|
8
|
+
Shirtsio.get('/test').should == 'success'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return BadRequest on 400" do
|
12
|
+
stub_request(:get, /https:\/\/www.shirts.io\/api\/v1\/.*/)
|
13
|
+
.to_return(body: '{ "result": "failure" }', status: 400, headers: { 'Content-Type' => 'application/json' })
|
14
|
+
expect { Shirtsio.get('/test') }.to raise_error(Shirtsio::BadRequest)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return Unauthorized on 401" do
|
18
|
+
stub_request(:get, /https:\/\/www.shirts.io\/api\/v1\/.*/)
|
19
|
+
.to_return(body: '{ "result": "failure" }', status: 401, headers: { 'Content-Type' => 'application/json' })
|
20
|
+
expect { Shirtsio.get('/test') }.to raise_error(Shirtsio::Unauthorized)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return RequestFailed on 402" do
|
24
|
+
stub_request(:get, /https:\/\/www.shirts.io\/api\/v1\/.*/)
|
25
|
+
.to_return(body: '{ "result": "failure" }', status: 402, headers: { 'Content-Type' => 'application/json' })
|
26
|
+
expect { Shirtsio.get('/test') }.to raise_error(Shirtsio::RequestFailed)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return Error for all other errors" do
|
30
|
+
stub_request(:get, /https:\/\/www.shirts.io\/api\/v1\/.*/)
|
31
|
+
.to_return(body: '{ "result": "failure" }', status: 500, headers: { 'Content-Type' => 'application/json' })
|
32
|
+
expect { Shirtsio.get('/test') }.to raise_error(Shirtsio::Error)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "POST" do
|
37
|
+
it "should return value on success" do
|
38
|
+
stub_request(:post, /https:\/\/www.shirts.io\/api\/v1\/.*/)
|
39
|
+
.to_return(body: '{ "result": "success" }', status: 200, headers: { 'Content-Type' => 'application/json' })
|
40
|
+
Shirtsio.post('/test').should == 'success'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,16 +3,22 @@
|
|
3
3
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
4
4
|
|
5
5
|
require 'simplecov'
|
6
|
+
require 'coveralls'
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
8
|
+
SimpleCov::Formatter::HTMLFormatter,
|
9
|
+
Coveralls::SimpleCov::Formatter
|
10
|
+
]
|
6
11
|
SimpleCov.start do
|
7
12
|
if Support::Travis::travis?
|
8
13
|
add_filter do |source_file|
|
9
|
-
['product_spec.rb', 'product.rb', 'order_spec.rb', 'order.rb', 'status_spec.rb', 'status.rb'].include?(File.basename(source_file.filename))
|
14
|
+
['product_spec.rb', 'product.rb', 'order_spec.rb', 'order.rb', 'status_spec.rb', 'status.rb', 'quote_spec.rb', 'quote.rb'].include?(File.basename(source_file.filename))
|
10
15
|
end
|
11
16
|
end
|
12
17
|
end
|
13
18
|
|
14
19
|
ENV['RAILS_ENV'] = 'test'
|
15
20
|
|
21
|
+
require 'webmock/rspec'
|
16
22
|
require 'tempfile'
|
17
23
|
require 'shirtsio'
|
18
24
|
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shirtsio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hashie
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: multi_json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.8'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.8'
|
55
55
|
description: A shirts.io API wrapper written in Ruby
|
56
56
|
email:
|
57
57
|
- anthony@sticksnleaves.com
|
@@ -59,8 +59,8 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .travis.yml
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
64
|
- Gemfile
|
65
65
|
- LICENSE.txt
|
66
66
|
- README.md
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- spec/order_spec.rb
|
86
86
|
- spec/product_spec.rb
|
87
87
|
- spec/quote_spec.rb
|
88
|
+
- spec/request_spec.rb
|
88
89
|
- spec/spec_helper.rb
|
89
90
|
- spec/status_spec.rb
|
90
91
|
- spec/support/ruby.jpg
|
@@ -100,17 +101,17 @@ require_paths:
|
|
100
101
|
- lib
|
101
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
103
|
requirements:
|
103
|
-
- -
|
104
|
+
- - ">="
|
104
105
|
- !ruby/object:Gem::Version
|
105
106
|
version: '0'
|
106
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
|
-
- -
|
109
|
+
- - ">="
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: '0'
|
111
112
|
requirements: []
|
112
113
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.2.0
|
114
115
|
signing_key:
|
115
116
|
specification_version: 4
|
116
117
|
summary: shirts.io REST API client library for Ruby
|
@@ -120,6 +121,7 @@ test_files:
|
|
120
121
|
- spec/order_spec.rb
|
121
122
|
- spec/product_spec.rb
|
122
123
|
- spec/quote_spec.rb
|
124
|
+
- spec/request_spec.rb
|
123
125
|
- spec/spec_helper.rb
|
124
126
|
- spec/status_spec.rb
|
125
127
|
- spec/support/ruby.jpg
|