stitches 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24af3456bfbce2bea0930b87b486a22d5ff0018c
4
- data.tar.gz: d5069bfe4189e10b001b281e551dfa7ec68b9f17
3
+ metadata.gz: 003a99a5a540913cf843dcc345cc20deb7232b18
4
+ data.tar.gz: 72e61198bbaab4965222bb2d4ceffb50d2d19313
5
5
  SHA512:
6
- metadata.gz: 0aba572158c721799fe513f012b1e83d23bee5969025510096e678135bc5e7462ae73acd668e8f9e41420a19cc9a1e9fcc8667ae5088039a8be5292b5950f361
7
- data.tar.gz: c375dd0a56a17eb67f0c4efd26866ced81d7bcab37b5643b44b018a97e5e25eb0760616cb9a5a627dd446b4446119989dadade686287f54721e7ffce36014659
6
+ metadata.gz: 472fa27a07d0e7d6a672ef0d08319ba6adc87362d72d0f0565a91248c2762602801e3e9d1b8c963be0e20eb38b2d79f0754d7da7099f4aa9f8b1887cb93b556e
7
+ data.tar.gz: da541780ea0f52bc024516fa73a37df4bbd8a37e5978f69598cd8d6e5a1c49a4e1f5f4285690ec1e00bec65d484f04d329cf1860934fc8f48e98744a56de8934
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.1.0
5
+ - 2.0.0
6
+ - 2.2.0
7
+ - ruby-head
8
+ notifications:
9
+ email: false
@@ -0,0 +1,6 @@
1
+ # Code of Conduct
2
+
3
+ We are committed to keeping our community open and inclusive.
4
+
5
+ **Our Code of Conduct can be found here**:
6
+ http://opensource.stitchfix.com/code-of-conduct.html
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stitches (3.2.0)
4
+ stitches (3.2.1)
5
5
  apitome
6
6
  pg
7
7
  rails
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  You'll be in stitches at how easy it is to get your API service up and running!
2
2
 
3
+ ![build status](https://travis-ci.org/stitchfix/resque-brain.svg?branch=master)
4
+
3
5
  This gem provides:
4
6
 
5
7
  * Rails plugin to handle api key and versioned requests
@@ -1,9 +1,22 @@
1
1
  module Stitches
2
2
  class Error
3
3
  attr_reader :code, :message
4
- def initialize(code:, message:)
5
- @code = code
6
- @message = message
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
@@ -1,3 +1,3 @@
1
1
  module Stitches
2
- VERSION = '3.2.0'
2
+ VERSION = '3.2.1'
3
3
  end
@@ -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.0
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-08-13 00:00:00.000000000 Z
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