Module: Airborne
- Includes:
- RequestExpectations
- Defined in:
- lib/airborne/base.rb,
lib/airborne/path_matcher.rb,
lib/airborne/rack_test_requester.rb,
lib/airborne/request_expectations.rb,
lib/airborne/rest_client_requester.rb,
lib/airborne/optional_hash_type_expectations.rb
Defined Under Namespace
Modules: PathMatcher, RackTestRequester, RequestExpectations, RestClientRequester
Classes: ExpectationError, InvalidJsonError, OptionalHashTypeExpectations, PathError
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
-
#delete(url, delete_body = nil, headers = nil, timeout = base_timeout) ⇒ Object
-
#get(url, headers = nil, timeout = base_timeout) ⇒ Object
-
#head(url, headers = nil, timeout = base_timeout) ⇒ Object
-
#json_body ⇒ Object
-
#options(url, headers = nil, timeout = base_timeout) ⇒ Object
-
#patch(url, patch_body = nil, headers = nil, timeout = base_timeout) ⇒ Object
-
#post(url, post_body = nil, headers = nil, timeout = base_timeout) ⇒ Object
-
#put(url, put_body = nil, headers = nil, timeout = base_timeout) ⇒ Object
#date, #expect_header, #expect_header_contains, #expect_json, #expect_json_keys, #expect_json_sizes, #expect_json_types, #expect_status, #optional, #regex
#get_by_path
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
10
11
12
|
# File 'lib/airborne/base.rb', line 10
def body
@body
end
|
Returns the value of attribute headers.
10
11
12
|
# File 'lib/airborne/base.rb', line 10
def
@headers
end
|
#response ⇒ Object
Returns the value of attribute response.
10
11
12
|
# File 'lib/airborne/base.rb', line 10
def response
@response
end
|
Class Method Details
.configuration ⇒ Object
28
29
30
|
# File 'lib/airborne/base.rb', line 28
def self.configuration
RSpec.configuration
end
|
12
13
14
15
16
|
# File 'lib/airborne/base.rb', line 12
def self.configure
RSpec.configure do |config|
yield config
end
end
|
Instance Method Details
#delete(url, delete_body = nil, headers = nil, timeout = base_timeout) ⇒ Object
48
49
50
|
# File 'lib/airborne/base.rb', line 48
def delete(url, delete_body = nil, = nil, timeout = base_timeout)
@response = make_request(:delete, url, body: delete_body, headers: , timeout: timeout)
end
|
#get(url, headers = nil, timeout = base_timeout) ⇒ Object
32
33
34
|
# File 'lib/airborne/base.rb', line 32
def get(url, = nil, timeout = base_timeout)
@response = make_request(:get, url, headers: , timeout: timeout)
end
|
#head(url, headers = nil, timeout = base_timeout) ⇒ Object
52
53
54
|
# File 'lib/airborne/base.rb', line 52
def head(url, = nil, timeout = base_timeout)
@response = make_request(:head, url, headers: , timeout: timeout)
end
|
#json_body ⇒ Object
72
73
74
|
# File 'lib/airborne/base.rb', line 72
def json_body
JSON.parse(response.body, symbolize_names: true) rescue fail InvalidJsonError, 'Api request returned invalid json'
end
|
#options(url, headers = nil, timeout = base_timeout) ⇒ Object
56
57
58
|
# File 'lib/airborne/base.rb', line 56
def options(url, = nil, timeout = base_timeout)
@response = make_request(:options, url, headers: , timeout: timeout)
end
|
#patch(url, patch_body = nil, headers = nil, timeout = base_timeout) ⇒ Object
40
41
42
|
# File 'lib/airborne/base.rb', line 40
def patch(url, patch_body = nil, = nil, timeout = base_timeout)
@response = make_request(:patch, url, body: patch_body, headers: , timeout: timeout)
end
|
#post(url, post_body = nil, headers = nil, timeout = base_timeout) ⇒ Object
36
37
38
|
# File 'lib/airborne/base.rb', line 36
def post(url, post_body = nil, = nil, timeout = base_timeout)
@response = make_request(:post, url, body: post_body, headers: , timeout: timeout)
end
|
#put(url, put_body = nil, headers = nil, timeout = base_timeout) ⇒ Object
44
45
46
|
# File 'lib/airborne/base.rb', line 44
def put(url, put_body = nil, = nil, timeout = base_timeout)
@response = make_request(:put, url, body: put_body, headers: , timeout: timeout)
end
|