apill 2.2.0 → 2.3.0

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: 83d6429288497499ef52987e7f8f9a5c8d8c7f6c
4
- data.tar.gz: a07b1f22022080022b72665a07b212c58aba56d4
3
+ metadata.gz: c80e6572755af69fbfa5998dabbf1231921a72c9
4
+ data.tar.gz: 2727edeb979c451907dbd1e3ef15cc1bf4fb98b5
5
5
  SHA512:
6
- metadata.gz: 80896fdee5a9fd08bf3ba02449d54d481415ccb6fa82424312fa3aaa329bcaf1492ac14d93f4f7bca224cbe7cc78f2da21210f5e07b9992887dfcce8d6f3bb3d
7
- data.tar.gz: 875abc5d8d8999fe9e649f2fde48305c2f822ecdc820ba2aad2c7f8d79aa906eb69b9a135bfb3129d8ff55458be3f294ba20d53dad75727111786c5de8641acf
6
+ metadata.gz: a92ed1e2312cfca05317328b48c3e5e5b8bd93c2c246aefed7f479775744b9ab1ca31ea24d74d7a4de0c4421ac31848b50838089449f3ce503f80da441963ca1
7
+ data.tar.gz: 5c6262450fcbd115923654bd86658e0378d566c98bdb46620df70f45129827e40aab6f74f86aba553217c1f8d56eb181a1e70614f4670be050e28c7d0ace3004
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
@@ -43,7 +43,7 @@ class AcceptHeader
43
43
  end
44
44
 
45
45
  def version_format
46
- "\\d+(?:\\.\\d+){0,2}(?:beta(?:\\d*))?"
46
+ '\\d+(?:\\.\\d+){0,2}(?:beta(?:\\d*))?'
47
47
  end
48
48
  end
49
49
  end
@@ -10,7 +10,8 @@ class InvalidApiRequestError < HumanError::Errors::RequestError
10
10
  end
11
11
 
12
12
  def developer_message
13
- 'The accept header that you passed in the request cannot be parsed, please refer to the documentation to verify.'
13
+ 'The accept header that you passed in the request cannot be parsed, ' \
14
+ 'please refer to the documentation to verify.'
14
15
  end
15
16
 
16
17
  def developer_details
@@ -9,7 +9,7 @@ module GenericMatcher
9
9
 
10
10
  def initialize(**args)
11
11
  args.each do |variable, value|
12
- self.send("#{variable}=", value)
12
+ send("#{variable}=", value)
13
13
  end
14
14
  end
15
15
 
@@ -1,7 +1,6 @@
1
- require 'json'
2
1
  require 'apill/configuration'
3
2
  require 'apill/matchers/subdomain_matcher'
4
- require 'apill/matchers/invalid_api_request_matcher'
3
+ require 'apill/matchers/accept_header_matcher'
5
4
  require 'apill/responses/invalid_api_request_response'
6
5
  require 'apill/responses/invalid_subdomain_response'
7
6
 
@@ -0,0 +1,51 @@
1
+ module Apill
2
+ module Mixins
3
+ module Pageable
4
+ module ClassMethods
5
+ def paginate(model)
6
+ define_method(:paginated_model_name) do
7
+ model
8
+ end
9
+ end
10
+ end
11
+
12
+ def self.included(base)
13
+ base.extend ClassMethods
14
+ end
15
+
16
+ private
17
+
18
+ def filtered_resource
19
+ @filtered_resource ||= begin
20
+ page_number = params[:page]
21
+ items_per_page = params[:per_page]
22
+
23
+ resource = if defined? super
24
+ super
25
+ else
26
+ send(paginated_model_name)
27
+ end
28
+
29
+ resource.
30
+ page(page_number).
31
+ per(items_per_page)
32
+ end
33
+ end
34
+
35
+ def filter_data
36
+ filter_data = defined?(super) ? super : {}
37
+
38
+ filter_data.merge(pagination_data)
39
+ end
40
+
41
+ def pagination_data
42
+ {
43
+ total_pages: filtered_resource.total_pages,
44
+ current_page: filtered_resource.current_page,
45
+ previous_page: filtered_resource.prev_page,
46
+ next_page: filtered_resource.next_page,
47
+ }
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,54 @@
1
+ module Apill
2
+ module Mixins
3
+ module Queryable
4
+ module ClassMethods
5
+ def query(model)
6
+ define_method(:queryed_model_name) do
7
+ model
8
+ end
9
+ end
10
+ end
11
+
12
+ def self.included(base)
13
+ base.extend ClassMethods
14
+ end
15
+
16
+ private
17
+
18
+ def filtered_resource
19
+ @filtered_resource ||= begin
20
+ resource = if defined? super
21
+ super
22
+ else
23
+ send(queryed_model_name)
24
+ end
25
+
26
+ sanitized_query_params.reduce(resource) do |query_resource, query_param|
27
+ key, value = query_param
28
+
29
+ query_resource.public_send(query_method_name_for(key, query_resource), value)
30
+ end
31
+ end
32
+ end
33
+
34
+ def query_params
35
+ @query_params ||= params.fetch(:query_params, {})
36
+ end
37
+
38
+ def sanitized_query_params
39
+ query_attrs = respond_to?(:queryable_attributes) ? queryable_attributes : {}
40
+
41
+ query_params.
42
+ slice(*query_attrs)
43
+ end
44
+
45
+ def query_method_name_for(query_item, resource)
46
+ if resource.respond_to? "for_#{query_item}"
47
+ "for_#{query_item}"
48
+ elsif resource.respond_to? query_item
49
+ query_item
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,49 @@
1
+ module Apill
2
+ module Mixins
3
+ module Sortable
4
+ module ClassMethods
5
+ def sort(model)
6
+ define_method(:sorted_model_name) do
7
+ model
8
+ end
9
+ end
10
+ end
11
+
12
+ def self.included(base)
13
+ base.extend ClassMethods
14
+ end
15
+
16
+ private
17
+
18
+ def filtered_resource
19
+ @filtered_resource ||= begin
20
+ resource = if defined? super
21
+ super
22
+ else
23
+ send(sorted_model_name)
24
+ end
25
+
26
+ resource.
27
+ order(sorting_arguments)
28
+ end
29
+ end
30
+
31
+ def sorting_arguments
32
+ sorting_data.values.join(' ')
33
+ end
34
+
35
+ def filter_data
36
+ filter_data = defined?(super) ? super : {}
37
+
38
+ filter_data.merge(sorting_data)
39
+ end
40
+
41
+ def sorting_data
42
+ {
43
+ sort: params.fetch(:sort, 'created_at'),
44
+ direction: params.fetch(:direction, 'DESC'),
45
+ }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -19,8 +19,6 @@ class Base
19
19
  end
20
20
  end
21
21
 
22
- private
23
-
24
22
  def self.rails_request_class
25
23
  require 'apill/requests/rails_request'
26
24
 
@@ -5,7 +5,7 @@ require 'apill/accept_header'
5
5
  module Apill
6
6
  module Requests
7
7
  class RackRequest < Base
8
- ACCEPT_PARAM_PATTERN = %r{(?:\A|&)accept=(.+?)(?=\z|&)}
8
+ ACCEPT_PARAM_PATTERN = /(?:\A|&)accept=(.+?)(?=\z|&)/
9
9
 
10
10
  attr_accessor :request
11
11
 
@@ -9,7 +9,7 @@ class InvalidApiRequestResponse
9
9
  [
10
10
  error.http_status, # HTTP Status Code
11
11
  {}, # Response Headers
12
- [ error.to_json ], # Message
12
+ [error.to_json], # Message
13
13
  ]
14
14
  end
15
15
  end
@@ -9,7 +9,7 @@ class InvalidSubdomainResponse
9
9
  [
10
10
  error.http_status, # HTTP Status Code
11
11
  {}, # Response Headers
12
- [ error.to_json ], # Message
12
+ [error.to_json], # Message
13
13
  ]
14
14
  end
15
15
  end
data/lib/apill/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Apill
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
data/lib/apill.rb CHANGED
@@ -1,10 +1,14 @@
1
+ require 'kaminari'
2
+
1
3
  require 'apill/version'
2
4
 
3
5
  require 'apill/configuration'
4
6
  require 'apill/matchers/accept_header_matcher'
5
- require 'apill/matchers/invalid_api_request_matcher'
6
7
  require 'apill/matchers/subdomain_matcher'
7
8
  require 'apill/matchers/version_matcher'
9
+ require 'apill/mixins/sortable'
10
+ require 'apill/mixins/queryable'
11
+ require 'apill/mixins/pageable'
8
12
 
9
13
  require 'apill/middleware/api_request'
10
14
 
@@ -4,101 +4,103 @@ require 'apill/accept_header'
4
4
  module Apill
5
5
  describe AcceptHeader do
6
6
  it 'can validate an accept header with all the pieces of information' do
7
- header = AcceptHeader.new(application: 'matrix',
8
- header: 'application/vnd.matrix+zion;version=1.0.0')
7
+ header = AcceptHeader.new(application: 'matrix',
8
+ header: 'application/vnd.matrix+zion;version=1.0.0')
9
9
 
10
10
  expect(header).to be_valid
11
11
  end
12
12
 
13
13
  it 'does not validate an accept header without passing an application' do
14
- header = AcceptHeader.new(application: '',
15
- header: 'application/vnd.matrix+zion;version=1.0.0')
14
+ header = AcceptHeader.new(application: '',
15
+ header: 'application/vnd.matrix+zion;version=1.0.0')
16
16
 
17
17
  expect(header).not_to be_valid
18
18
  end
19
19
 
20
20
  it 'does not validate an accept header if it is not passed in' do
21
- header = AcceptHeader.new(application: '',
22
- header: '')
21
+ header = AcceptHeader.new(application: '',
22
+ header: '')
23
23
 
24
24
  expect(header).not_to be_valid
25
25
 
26
- header = AcceptHeader.new(application: '',
27
- header: nil)
26
+ header = AcceptHeader.new(application: '',
27
+ header: nil)
28
28
 
29
29
  expect(header).not_to be_valid
30
30
  end
31
31
 
32
32
  it 'does not validate an accept header without an application in the header' do
33
- header = AcceptHeader.new(application: 'matrix',
34
- header: 'application/vnd.+zion;version=1.0.0')
33
+ header = AcceptHeader.new(application: 'matrix',
34
+ header: 'application/vnd.+zion;version=1.0.0')
35
35
 
36
36
  expect(header).not_to be_valid
37
37
 
38
- header = AcceptHeader.new(application: 'matrix',
39
- header: 'application/+zion;version=1.0.0')
38
+ header = AcceptHeader.new(application: 'matrix',
39
+ header: 'application/+zion;version=1.0.0')
40
40
 
41
41
  expect(header).not_to be_valid
42
42
 
43
- header = AcceptHeader.new(application: 'matrix',
44
- header: 'application/matrix+zion;version=1.0.0')
43
+ header = AcceptHeader.new(application: 'matrix',
44
+ header: 'application/matrix+zion;version=1.0.0')
45
45
 
46
46
  expect(header).not_to be_valid
47
47
  end
48
48
 
49
49
  it 'does not validate an accept header with an invalid version' do
50
- header = AcceptHeader.new(application: 'matrix',
51
- header: 'application/vnd.matrix+zion;version=10..0')
50
+ header = AcceptHeader.new(application: 'matrix',
51
+ header: 'application/vnd.matrix+zion;version=10..0')
52
52
 
53
53
  expect(header).not_to be_valid
54
54
 
55
- header = AcceptHeader.new(application: 'matrix',
56
- header: 'application/vnd.matrix+zion;version=neo')
55
+ header = AcceptHeader.new(application: 'matrix',
56
+ header: 'application/vnd.matrix+zion;version=neo')
57
57
 
58
58
  expect(header).not_to be_valid
59
59
 
60
- header = AcceptHeader.new(application: 'matrix',
61
- header: 'application/vnd.matrix+zion;version=')
60
+ header = AcceptHeader.new(application: 'matrix',
61
+ header: 'application/vnd.matrix+zion;version=')
62
62
 
63
63
  expect(header).not_to be_valid
64
64
 
65
- header = AcceptHeader.new(application: 'matrix',
66
- header: 'application/vnd.matrix+zion;10.0')
65
+ header = AcceptHeader.new(application: 'matrix',
66
+ header: 'application/vnd.matrix+zion;10.0')
67
67
 
68
68
  expect(header).not_to be_valid
69
69
  end
70
70
 
71
71
  it 'does validate an accept header even with a missing content type' do
72
- header = AcceptHeader.new(application: 'matrix',
73
- header: 'application/vnd.matrix;version=10.0')
72
+ header = AcceptHeader.new(application: 'matrix',
73
+ header: 'application/vnd.matrix;version=10.0')
74
74
 
75
75
  expect(header).to be_valid
76
76
  end
77
77
 
78
78
  it 'does validate an accept header with only the minimal information' do
79
- header = AcceptHeader.new(application: 'matrix',
80
- header: 'application/vnd.matrix')
79
+ header = AcceptHeader.new(application: 'matrix',
80
+ header: 'application/vnd.matrix')
81
81
 
82
82
  expect(header).to be_valid
83
83
  end
84
84
 
85
85
  it 'does validate an accept header with only a content type but no version' do
86
- header = AcceptHeader.new(application: 'matrix',
87
- header: 'application/vnd.matrix+zion')
86
+ header = AcceptHeader.new(application: 'matrix',
87
+ header: 'application/vnd.matrix+zion')
88
88
 
89
89
  expect(header).to be_valid
90
90
  end
91
91
 
92
92
  it 'can extract version information from an accept header' do
93
- header = AcceptHeader.new(application: 'matrix',
94
- header: 'application/vnd.matrix+zion;version=10.0.0beta1')
93
+ header = AcceptHeader.new(
94
+ application: 'matrix',
95
+ header: 'application/vnd.matrix+zion;version=10.0.0beta1')
95
96
 
96
97
  expect(header.version).to eql '10.0.0beta1'
97
98
  end
98
99
 
99
100
  it 'can extract the content type from an accept header' do
100
- header = AcceptHeader.new(application: 'matrix',
101
- header: 'application/vnd.matrix+zion;version=10.0.0beta1')
101
+ header = AcceptHeader.new(
102
+ application: 'matrix',
103
+ header: 'application/vnd.matrix+zion;version=10.0.0beta1')
102
104
 
103
105
  expect(header.content_type).to eql 'zion'
104
106
  end
@@ -19,7 +19,9 @@ describe InvalidApiRequestError do
19
19
  end
20
20
 
21
21
  it 'can output the developer message' do
22
- expect(error.developer_message).to eql 'The accept header that you passed in the request cannot be parsed, please refer to the documentation to verify.'
22
+ expect(error.developer_message).to eql 'The accept header that you passed in the ' \
23
+ 'request cannot be parsed, please refer to ' \
24
+ 'the documentation to verify.'
23
25
  end
24
26
 
25
27
  it 'can output the developer details' do
@@ -29,7 +31,8 @@ describe InvalidApiRequestError do
29
31
  end
30
32
 
31
33
  it 'can output the friendly message' do
32
- expect(error.friendly_message).to eql "Sorry! We couldn't understand what you were trying to ask us to do."
34
+ expect(error.friendly_message).to eql "Sorry! We couldn't understand what you were " \
35
+ 'trying to ask us to do.'
33
36
  end
34
37
  end
35
38
  end
@@ -27,17 +27,20 @@ describe InvalidSubdomainResponse do
27
27
  '"developer_documentation_uri":"http://error.com/1010?version=1",' \
28
28
  '"customer_support_uri":"http://knowledge.com/1234567890",' \
29
29
  '"developer_message_key":"errors.invalid.subdomain.error.developer",' \
30
- '"developer_message":"The resource you attempted to access is either not authorized for the authenticated user or does not exist.",' \
30
+ '"developer_message":"The resource you attempted to access is either not ' \
31
+ 'authorized for the authenticated user or does not ' \
32
+ 'exist.",' \
31
33
  '"developer_details":' \
32
34
  '{' \
33
35
  '"http_host":"api.example.com"' \
34
36
  '},' \
35
37
  '"friendly_message_key":"errors.invalid.subdomain.error.friendly",' \
36
- '"friendly_message":"Sorry! The resource you tried to access does not exist."' \
38
+ '"friendly_message":"Sorry! The resource you tried to access does not ' \
39
+ 'exist."' \
37
40
  '}' \
38
- '}'
39
- ]
40
- ]
41
+ '}',
42
+ ],
43
+ ],
41
44
  )
42
45
  end
43
46
  end
@@ -32,7 +32,8 @@ describe AcceptHeaderMatcher do
32
32
  'secondary parameter' do
33
33
 
34
34
  request = {
35
- 'QUERY_STRING' => 'first=my_param&accept=application/vnd.matrix+zion;version=1.0.0',
35
+ 'QUERY_STRING' => 'first=my_param&accept=application/vnd.matrix+zion;' \
36
+ 'version=1.0.0',
36
37
  'HTTP_X_APPLICATION_NAME' => 'matrix',
37
38
  }
38
39
 
@@ -4,7 +4,7 @@ require 'apill/middleware/api_request'
4
4
  module Apill
5
5
  module Middleware
6
6
  describe ApiRequest do
7
- let(:app) { lambda { |env| [200, {}, 'response'] } }
7
+ let(:app) { ->(_env) { [200, {}, 'response'] } }
8
8
 
9
9
  before(:each) do
10
10
  HumanError.configure do |config|
@@ -23,9 +23,9 @@ describe ApiRequest do
23
23
  api_request_middleware = ApiRequest.new(app)
24
24
 
25
25
  request = {
26
- 'HTTP_HOST' => 'notvalid.example.com',
27
- 'HTTP_ACCEPT' => '',
28
- 'QUERY_STRING' => 'first=my_param&accept=application/vnd.silent+zion;version=1.0.0',
26
+ 'HTTP_HOST' => 'notvalid.example.com',
27
+ 'HTTP_ACCEPT' => '',
28
+ 'QUERY_STRING' => 'first=my_param&accept=application/vnd.silent+zion;version=1.0.0',
29
29
  }
30
30
 
31
31
  status, headers, response = api_request_middleware.call(request)
@@ -42,16 +42,19 @@ describe ApiRequest do
42
42
  '"developer_documentation_uri":"http://error.com/1010?version=1",' \
43
43
  '"customer_support_uri":"http://knowledge.com/1234567890",' \
44
44
  '"developer_message_key":"errors.invalid.subdomain.error.developer",' \
45
- '"developer_message":"The resource you attempted to access is either not authorized for the authenticated user or does not exist.",' \
45
+ '"developer_message":"The resource you attempted to access is either not ' \
46
+ 'authorized for the authenticated user or does not ' \
47
+ 'exist.",' \
46
48
  '"developer_details":' \
47
49
  '{' \
48
50
  '"http_host":"notvalid.example.com"' \
49
51
  '},' \
50
52
  '"friendly_message_key":"errors.invalid.subdomain.error.friendly",' \
51
- '"friendly_message":"Sorry! The resource you tried to access does not exist."' \
53
+ '"friendly_message":"Sorry! The resource you tried to access does not ' \
54
+ 'exist."' \
52
55
  '}' \
53
- '}'
54
- ]
56
+ '}',
57
+ ],
55
58
  )
56
59
  end
57
60
 
@@ -61,9 +64,9 @@ describe ApiRequest do
61
64
  api_request_middleware = ApiRequest.new(app)
62
65
 
63
66
  request = {
64
- 'HTTP_HOST' => 'api.example.com',
65
- 'HTTP_ACCEPT' => '',
66
- 'QUERY_STRING' => 'first=my_param&accept=application/vnd.silent+zion;version=1.0.0',
67
+ 'HTTP_HOST' => 'api.example.com',
68
+ 'HTTP_ACCEPT' => '',
69
+ 'QUERY_STRING' => 'first=my_param&accept=application/vnd.silent+zion;version=1.0.0',
67
70
  }
68
71
 
69
72
  status, headers, response = api_request_middleware.call(request)
@@ -80,16 +83,19 @@ describe ApiRequest do
80
83
  '"developer_documentation_uri":"http://error.com/1007?version=1",' \
81
84
  '"customer_support_uri":"http://knowledge.com/1234567890",' \
82
85
  '"developer_message_key":"errors.invalid.api.request.error.developer",' \
83
- '"developer_message":"The accept header that you passed in the request cannot be parsed, please refer to the documentation to verify.",' \
86
+ '"developer_message":"The accept header that you passed in the request ' \
87
+ 'cannot be parsed, please refer to the documentation ' \
88
+ 'to verify.",' \
84
89
  '"developer_details":' \
85
90
  '{' \
86
91
  '"accept_header":""' \
87
92
  '},' \
88
93
  '"friendly_message_key":"errors.invalid.api.request.error.friendly",' \
89
- '"friendly_message":"Sorry! We couldn\'t understand what you were trying to ask us to do."' \
94
+ '"friendly_message":"Sorry! We couldn\'t understand what you were trying ' \
95
+ 'to ask us to do."' \
90
96
  '}' \
91
- '}'
92
- ]
97
+ '}',
98
+ ],
93
99
  )
94
100
  end
95
101
 
@@ -97,9 +103,9 @@ describe ApiRequest do
97
103
  api_request_middleware = ApiRequest.new(app)
98
104
 
99
105
  request = {
100
- 'HTTP_HOST' => 'api.example.com',
101
- 'HTTP_ACCEPT' => 'application/vnd.matrix+zion;version=1.0.0',
102
- 'QUERY_STRING' => 'first=my_param&accept=application/vnd.matrix+zion;version=1.0.0',
106
+ 'HTTP_HOST' => 'api.example.com',
107
+ 'HTTP_ACCEPT' => 'application/vnd.matrix+zion;version=1.0.0',
108
+ 'QUERY_STRING' => 'first=my_param&accept=application/vnd.matrix+zion;version=1.0.0',
103
109
  }
104
110
 
105
111
  status, headers, response = api_request_middleware.call(request)
@@ -45,8 +45,8 @@ describe RackRequest do
45
45
  Apill.configuration.application_name = 'zion'
46
46
 
47
47
  raw_request = {
48
- 'HTTP_ACCEPT' => '',
49
- 'QUERY_STRING' => 'accept=application/vnd.zion+zion;version=10.0',
48
+ 'HTTP_ACCEPT' => '',
49
+ 'QUERY_STRING' => 'accept=application/vnd.zion+zion;version=10.0',
50
50
  }
51
51
  request = RackRequest.new(raw_request)
52
52
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apill
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfelchner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-07 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: human_error
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: kaminari
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.16.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.16.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rspec
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -82,10 +96,12 @@ files:
82
96
  - lib/apill/errors/invalid_subdomain_error.rb
83
97
  - lib/apill/matchers/accept_header_matcher.rb
84
98
  - lib/apill/matchers/generic_matcher.rb
85
- - lib/apill/matchers/invalid_api_request_matcher.rb
86
99
  - lib/apill/matchers/subdomain_matcher.rb
87
100
  - lib/apill/matchers/version_matcher.rb
88
101
  - lib/apill/middleware/api_request.rb
102
+ - lib/apill/mixins/pageable.rb
103
+ - lib/apill/mixins/queryable.rb
104
+ - lib/apill/mixins/sortable.rb
89
105
  - lib/apill/requests/base.rb
90
106
  - lib/apill/requests/rack_request.rb
91
107
  - lib/apill/requests/rails_request.rb
@@ -97,7 +113,6 @@ files:
97
113
  - spec/apill/errors/invalid_subdomain_error_spec.rb
98
114
  - spec/apill/invalid_subdomain_response_spec.rb
99
115
  - spec/apill/matchers/accept_header_matcher_spec.rb
100
- - spec/apill/matchers/invalid_api_request_matcher_spec.rb
101
116
  - spec/apill/matchers/subdomain_matcher_spec.rb
102
117
  - spec/apill/matchers/version_matcher_spec.rb
103
118
  - spec/apill/middleware/api_request_spec.rb
@@ -123,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
138
  version: '0'
124
139
  requirements: []
125
140
  rubyforge_project:
126
- rubygems_version: 2.4.2
141
+ rubygems_version: 2.2.2
127
142
  signing_key:
128
143
  specification_version: 4
129
144
  summary: Common API functionality
@@ -133,7 +148,6 @@ test_files:
133
148
  - spec/apill/errors/invalid_subdomain_error_spec.rb
134
149
  - spec/apill/invalid_subdomain_response_spec.rb
135
150
  - spec/apill/matchers/accept_header_matcher_spec.rb
136
- - spec/apill/matchers/invalid_api_request_matcher_spec.rb
137
151
  - spec/apill/matchers/subdomain_matcher_spec.rb
138
152
  - spec/apill/matchers/version_matcher_spec.rb
139
153
  - spec/apill/middleware/api_request_spec.rb
@@ -1,11 +0,0 @@
1
- require 'apill/matchers/accept_header_matcher'
2
-
3
- module Apill
4
- module Matchers
5
- class InvalidApiRequestMatcher < AcceptHeaderMatcher
6
- def matches?(request)
7
- !super
8
- end
9
- end
10
- end
11
- end
@@ -1,21 +0,0 @@
1
- require 'ostruct'
2
- require 'rspectacular'
3
- require 'apill/matchers/invalid_api_request_matcher'
4
-
5
- module Apill
6
- module Matchers
7
- describe InvalidApiRequestMatcher do
8
- it 'is the inverse of whether the accept header matches' do
9
- request = {
10
- 'HTTP_HOST' => 'api.example.com',
11
- 'HTTP_ACCEPT' => 'application/vnd.matrix+zion;version=1.0.0',
12
- 'HTTP_X_APPLICATION_NAME' => 'matrix',
13
- }
14
-
15
- matcher = InvalidApiRequestMatcher.new
16
-
17
- expect(matcher.matches?(request)).to be_a FalseClass
18
- end
19
- end
20
- end
21
- end