flipper-api 0.10.0 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd696bdc261c62486cab5a607d1ef98e21eaf9d1
4
- data.tar.gz: 3bec1050517cd29ac18233562644ea0d859f00b7
3
+ metadata.gz: a8d6ccc6c34438ef6ba81277e0b73ce2e6516864
4
+ data.tar.gz: bfb403790c9c4697dfe1d164d8795c628dd89e05
5
5
  SHA512:
6
- metadata.gz: 08e7142b00964657bf6e21afc3fb192c900305b8825e67c500bffc1e51bfe271a80be3f2ac6b0288cf9fb44eb3476bddc0220013e01f6b8339454d0a42159deb
7
- data.tar.gz: f6c94f090cc3e2745348a06edaf4aed37449df84879888f697e55b14046a7cb1e9ff4f0e9a9b657afd39db3df6a5d743e4640fcd8514999c8c3280a4c94df364
6
+ metadata.gz: bedb216998aeaf11f155be1f9e2b0fe2ffb07ee9c7373127c8eaa2bc6d80a7f7723cde757224853ad85af6cac9450cc2af36c21a7fb9767d24c3a2b28904737f
7
+ data.tar.gz: ecfc9fccd124e88e2609abbeaf538ef5b20fb467c429fc4b1263ea2592d29f979edcf17e4cdd25c74aba45c6dbcf589a1470afca5a1a1781d9a64439fb0c006d
@@ -4,10 +4,10 @@ module Flipper
4
4
  class Error
5
5
  attr_reader :http_status
6
6
 
7
- def initialize(code, message, info, http_status)
7
+ def initialize(code, message, http_status)
8
8
  @code = code
9
9
  @message = message
10
- @more_info = info
10
+ @more_info = "https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference"
11
11
  @http_status = http_status
12
12
  end
13
13
 
@@ -21,12 +21,13 @@ module Flipper
21
21
  end
22
22
 
23
23
  ERRORS = {
24
- feature_not_found: Error.new(1, "Feature not found.", "", 404),
25
- group_not_registered: Error.new(2, "Group not registered.", "", 404),
26
- percentage_invalid: Error.new(3, "Percentage must be a positive number less than or equal to 100.", "", 422),
27
- flipper_id_invalid: Error.new(4, "Required parameter flipper_id is missing.", "", 422),
28
- name_invalid: Error.new(5, "Required parameter name is missing.", "", 422),
24
+ feature_not_found: Error.new(1, "Feature not found.", 404),
25
+ group_not_registered: Error.new(2, "Group not registered.", 404),
26
+ percentage_invalid: Error.new(3, "Percentage must be a positive number less than or equal to 100.", 422),
27
+ flipper_id_invalid: Error.new(4, "Required parameter flipper_id is missing.", 422),
28
+ name_invalid: Error.new(5, "Required parameter name is missing.", 422),
29
29
  }
30
+
30
31
  end
31
32
  end
32
33
  end
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = "0.10.0".freeze
2
+ VERSION = "0.10.1".freeze
3
3
  end
@@ -74,7 +74,7 @@ RSpec.describe Flipper::Api::Action do
74
74
  expect(headers["Content-Type"]).to eq("application/json")
75
75
  expect(parsed_body["code"]).to eq(1)
76
76
  expect(parsed_body["message"]).to eq("Feature not found.")
77
- expect(parsed_body["more_info"]).to eq("")
77
+ expect(parsed_body["more_info"]).to eq("https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference")
78
78
  end
79
79
  end
80
80
 
@@ -91,7 +91,7 @@ RSpec.describe Flipper::Api::Action do
91
91
  expect(headers["Content-Type"]).to eq("application/json")
92
92
  expect(parsed_body["code"]).to eq(2)
93
93
  expect(parsed_body["message"]).to eq("Group not registered.")
94
- expect(parsed_body["more_info"]).to eq("")
94
+ expect(parsed_body["more_info"]).to eq("https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference")
95
95
  end
96
96
  end
97
97
 
@@ -51,7 +51,7 @@ RSpec.describe Flipper::Api::V1::Actions::ActorsGate do
51
51
 
52
52
  it 'returns correct error response' do
53
53
  expect(last_response.status).to eq(422)
54
- expect(json_response).to eq({ 'code' => 4, 'message' => 'Required parameter flipper_id is missing.', 'more_info' => '' })
54
+ expect(json_response).to eq({ 'code' => 4, 'message' => 'Required parameter flipper_id is missing.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
55
55
  end
56
56
  end
57
57
 
@@ -63,7 +63,7 @@ RSpec.describe Flipper::Api::V1::Actions::ActorsGate do
63
63
 
64
64
  it 'returns correct error response' do
65
65
  expect(last_response.status).to eq(422)
66
- expect(json_response).to eq({ 'code' => 4, 'message' => 'Required parameter flipper_id is missing.', 'more_info' => '' })
66
+ expect(json_response).to eq({ 'code' => 4, 'message' => 'Required parameter flipper_id is missing.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
67
67
  end
68
68
  end
69
69
 
@@ -75,7 +75,7 @@ RSpec.describe Flipper::Api::V1::Actions::ActorsGate do
75
75
 
76
76
  it 'returns correct error response' do
77
77
  expect(last_response.status).to eq(422)
78
- expect(json_response).to eq({ 'code' => 4, 'message' => 'Required parameter flipper_id is missing.', 'more_info' => '' })
78
+ expect(json_response).to eq({ 'code' => 4, 'message' => 'Required parameter flipper_id is missing.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
79
79
  end
80
80
  end
81
81
 
@@ -87,7 +87,7 @@ RSpec.describe Flipper::Api::V1::Actions::ActorsGate do
87
87
 
88
88
  it 'returns correct error response' do
89
89
  expect(last_response.status).to eq(422)
90
- expect(json_response).to eq({ 'code' => 4, 'message' => 'Required parameter flipper_id is missing.', 'more_info' => '' })
90
+ expect(json_response).to eq({ 'code' => 4, 'message' => 'Required parameter flipper_id is missing.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
91
91
  end
92
92
  end
93
93
 
@@ -98,7 +98,7 @@ RSpec.describe Flipper::Api::V1::Actions::ActorsGate do
98
98
 
99
99
  it 'returns correct error response' do
100
100
  expect(last_response.status).to eq(404)
101
- expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => '' })
101
+ expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
102
102
  end
103
103
  end
104
104
 
@@ -109,7 +109,7 @@ RSpec.describe Flipper::Api::V1::Actions::ActorsGate do
109
109
 
110
110
  it 'returns correct error response' do
111
111
  expect(last_response.status).to eq(404)
112
- expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => '' })
112
+ expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
113
113
  end
114
114
  end
115
115
  end
@@ -105,7 +105,7 @@ RSpec.describe Flipper::Api::V1::Actions::Feature do
105
105
  end
106
106
 
107
107
  it 'returns formatted error response body' do
108
- expect(json_response).to eq({ "code" => 1, "message" => "Feature not found.", "more_info" => "" })
108
+ expect(json_response).to eq({ "code" => 1, "message" => "Feature not found.", "more_info" => "https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference" })
109
109
  end
110
110
  end
111
111
  end
@@ -131,7 +131,7 @@ RSpec.describe Flipper::Api::V1::Actions::Feature do
131
131
  end
132
132
 
133
133
  it 'returns formatted error response body' do
134
- expect(json_response).to eq({ "code" => 1, "message" => "Feature not found.", "more_info" => "" })
134
+ expect(json_response).to eq({ "code" => 1, "message" => "Feature not found.", "more_info" => "https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference" })
135
135
  end
136
136
  end
137
137
  end
@@ -134,7 +134,7 @@ RSpec.describe Flipper::Api::V1::Actions::Features do
134
134
  end
135
135
 
136
136
  it 'returns formatted error' do
137
- expect(json_response).to eq({ 'code' => 5, 'message' => 'Required parameter name is missing.', 'more_info' => '' })
137
+ expect(json_response).to eq({ 'code' => 5, 'message' => 'Required parameter name is missing.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
138
138
  end
139
139
  end
140
140
  end
@@ -57,7 +57,7 @@ RSpec.describe Flipper::Api::V1::Actions::GroupsGate do
57
57
 
58
58
  it '404s with correct error response when feature does not exist' do
59
59
  expect(last_response.status).to eq(404)
60
- expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => '' })
60
+ expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
61
61
  end
62
62
  end
63
63
 
@@ -69,7 +69,7 @@ RSpec.describe Flipper::Api::V1::Actions::GroupsGate do
69
69
 
70
70
  it '404s with correct error response when group not registered' do
71
71
  expect(last_response.status).to eq(404)
72
- expect(json_response).to eq({ 'code' => 2, 'message' => 'Group not registered.', 'more_info' => '' })
72
+ expect(json_response).to eq({ 'code' => 2, 'message' => 'Group not registered.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
73
73
  end
74
74
  end
75
75
  end
@@ -43,7 +43,7 @@ RSpec.describe Flipper::Api::V1::Actions::PercentageOfActorsGate do
43
43
 
44
44
  it '404s with correct error response when feature does not exist' do
45
45
  expect(last_response.status).to eq(404)
46
- expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => '' })
46
+ expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
47
47
  end
48
48
  end
49
49
 
@@ -55,7 +55,7 @@ RSpec.describe Flipper::Api::V1::Actions::PercentageOfActorsGate do
55
55
 
56
56
  it '422s with correct error response when percentage parameter is invalid' do
57
57
  expect(last_response.status).to eq(422)
58
- expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => '' })
58
+ expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
59
59
  end
60
60
  end
61
61
 
@@ -67,7 +67,7 @@ RSpec.describe Flipper::Api::V1::Actions::PercentageOfActorsGate do
67
67
 
68
68
  it '422s with correct error response when percentage parameter is invalid' do
69
69
  expect(last_response.status).to eq(422)
70
- expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => '' })
70
+ expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
71
71
  end
72
72
  end
73
73
 
@@ -79,7 +79,7 @@ RSpec.describe Flipper::Api::V1::Actions::PercentageOfActorsGate do
79
79
 
80
80
  it '422s with correct error response when percentage parameter is missing' do
81
81
  expect(last_response.status).to eq(422)
82
- expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => '' })
82
+ expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
83
83
  end
84
84
  end
85
85
  end
@@ -42,7 +42,7 @@ RSpec.describe Flipper::Api::V1::Actions::PercentageOfTimeGate do
42
42
 
43
43
  it '404s with correct error response when feature does not exist' do
44
44
  expect(last_response.status).to eq(404)
45
- expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => '' })
45
+ expect(json_response).to eq({ 'code' => 1, 'message' => 'Feature not found.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
46
46
  end
47
47
  end
48
48
 
@@ -54,7 +54,7 @@ RSpec.describe Flipper::Api::V1::Actions::PercentageOfTimeGate do
54
54
 
55
55
  it '422s with correct error response when percentage parameter is invalid' do
56
56
  expect(last_response.status).to eq(422)
57
- expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => '' })
57
+ expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
58
58
  end
59
59
  end
60
60
 
@@ -66,7 +66,7 @@ RSpec.describe Flipper::Api::V1::Actions::PercentageOfTimeGate do
66
66
 
67
67
  it '422s with correct error response when percentage parameter is invalid' do
68
68
  expect(last_response.status).to eq(422)
69
- expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => '' })
69
+ expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
70
70
  end
71
71
  end
72
72
 
@@ -78,7 +78,7 @@ RSpec.describe Flipper::Api::V1::Actions::PercentageOfTimeGate do
78
78
 
79
79
  it '422s with correct error response when percentage parameter is missing' do
80
80
  expect(last_response.status).to eq(422)
81
- expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => '' })
81
+ expect(json_response).to eq({ 'code' => 3, 'message' => 'Percentage must be a positive number less than or equal to 100.', 'more_info' => 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference' })
82
82
  end
83
83
  end
84
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2016-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.10.0
39
+ version: 0.10.1
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.10.0
46
+ version: 0.10.1
47
47
  description: Rack middleware that provides an API for the flipper gem.
48
48
  email:
49
49
  - nunemaker@gmail.com