stitches 3.2.0 → 3.2.1
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 +4 -4
- data/.travis.yml +9 -0
- data/CODE_OF_CONDUCT.md +6 -0
- data/CONTRIBUTING.md +18 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/stitches/error.rb +17 -4
- data/lib/stitches/spec/api_clients.rb +2 -2
- data/lib/stitches/version.rb +1 -1
- data/spec/error_spec.rb +45 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 003a99a5a540913cf843dcc345cc20deb7232b18
|
4
|
+
data.tar.gz: 72e61198bbaab4965222bb2d4ceffb50d2d19313
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 472fa27a07d0e7d6a672ef0d08319ba6adc87362d72d0f0565a91248c2762602801e3e9d1b8c963be0e20eb38b2d79f0754d7da7099f4aa9f8b1887cb93b556e
|
7
|
+
data.tar.gz: da541780ea0f52bc024516fa73a37df4bbd8a37e5978f69598cd8d6e5a1c49a4e1f5f4285690ec1e00bec65d484f04d329cf1860934fc8f48e98744a56de8934
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Contributing
|
2
|
+
Thanks for using and improving *stitches*! If you'd like to help out, check out [the project's issues list](https://github.com/stitchfix/stitches/issues) for ideas on what could be improved. If there's an idea you'd like to propose, or a design change, feel free to file a new issue or send a pull request:
|
3
|
+
|
4
|
+
1. [Fork][fork] the repo.
|
5
|
+
1. [Create a topic branch.][branch]
|
6
|
+
1. Write tests.
|
7
|
+
1. Implement your feature or fix bug.
|
8
|
+
1. Add, commit, and push your changes.
|
9
|
+
1. [Submit a pull request.][pr]
|
10
|
+
|
11
|
+
[fork]: https://help.github.com/articles/fork-a-repo/
|
12
|
+
[branch]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
|
13
|
+
[pr]: https://help.github.com/articles/using-pull-requests/
|
14
|
+
|
15
|
+
## General Guidelines
|
16
|
+
|
17
|
+
* When in doubt, test it. If you can't test it, re-think what you are doing.
|
18
|
+
* Code formatting and internal application architecture should be consistent.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/stitches/error.rb
CHANGED
@@ -1,9 +1,22 @@
|
|
1
1
|
module Stitches
|
2
2
|
class Error
|
3
3
|
attr_reader :code, :message
|
4
|
-
def initialize(
|
5
|
-
|
6
|
-
|
4
|
+
def initialize(options = {})
|
5
|
+
[:code, :message].each do |key|
|
6
|
+
unless options.has_key?(key)
|
7
|
+
raise MissingParameter.new(self.class,key)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
@code = options[:code]
|
12
|
+
@message = options[:message]
|
7
13
|
end
|
14
|
+
|
15
|
+
class MissingParameter < StandardError
|
16
|
+
def initialize(klass,param_name)
|
17
|
+
super("#{ klass.name } must be initialized with :#{ param_name }")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
8
21
|
end
|
9
|
-
end
|
22
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ApiClients
|
2
|
-
def api_client(name: "test")
|
3
|
-
::ApiClient.where(name: name).first or ::ApiClient.create!(name: name).reload
|
2
|
+
def api_client(options = { name: "test" })
|
3
|
+
::ApiClient.where(name: options[:name]).first or ::ApiClient.create!(name: options[:name]).reload
|
4
4
|
end
|
5
5
|
end
|
data/lib/stitches/version.rb
CHANGED
data/spec/error_spec.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Stitches
|
4
|
+
describe Error do
|
5
|
+
describe '#initialize' do
|
6
|
+
context 'required params are set' do
|
7
|
+
it 'does not raise error' do
|
8
|
+
expect do
|
9
|
+
described_class.new(code: anything, message: anything)
|
10
|
+
end.to_not raise_error
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'code is missing' do
|
15
|
+
it 'raises a descriptive error' do
|
16
|
+
expect do
|
17
|
+
described_class.new(message: 'foo')
|
18
|
+
end.to raise_error(
|
19
|
+
described_class::MissingParameter,
|
20
|
+
'Stitches::Error must be initialized with :code')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'message is missing' do
|
25
|
+
it 'raises a descriptive error' do
|
26
|
+
expect do
|
27
|
+
described_class.new(code: 123)
|
28
|
+
end.to raise_error(
|
29
|
+
described_class::MissingParameter,
|
30
|
+
'Stitches::Error must be initialized with :message')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'both are missing' do
|
35
|
+
it 'raises an error about code' do
|
36
|
+
expect do
|
37
|
+
described_class.new(message: 'foo')
|
38
|
+
end.to raise_error(
|
39
|
+
described_class::MissingParameter,
|
40
|
+
'Stitches::Error must be initialized with :code')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stitches
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stitch Fix Engineering
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-11-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -111,6 +111,9 @@ files:
|
|
111
111
|
- ".gitignore"
|
112
112
|
- ".ruby-gemset"
|
113
113
|
- ".ruby-version"
|
114
|
+
- ".travis.yml"
|
115
|
+
- CODE_OF_CONDUCT.md
|
116
|
+
- CONTRIBUTING.md
|
114
117
|
- Gemfile
|
115
118
|
- Gemfile.lock
|
116
119
|
- LICENSE.txt
|
@@ -150,6 +153,7 @@ files:
|
|
150
153
|
- spec/api_key_spec.rb
|
151
154
|
- spec/api_version_constraint_spec.rb
|
152
155
|
- spec/configuration_spec.rb
|
156
|
+
- spec/error_spec.rb
|
153
157
|
- spec/errors_spec.rb
|
154
158
|
- spec/spec/have_api_error_spec.rb
|
155
159
|
- spec/spec_helper.rb
|
@@ -183,6 +187,7 @@ test_files:
|
|
183
187
|
- spec/api_key_spec.rb
|
184
188
|
- spec/api_version_constraint_spec.rb
|
185
189
|
- spec/configuration_spec.rb
|
190
|
+
- spec/error_spec.rb
|
186
191
|
- spec/errors_spec.rb
|
187
192
|
- spec/spec/have_api_error_spec.rb
|
188
193
|
- spec/spec_helper.rb
|