marble_api_client 1.0.0.pre.alpha → 1.0.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +4 -5
- data/README.md +5 -7
- data/lib/marble_api_client/{proxy.rb → client.rb} +11 -13
- data/lib/marble_api_client/requests/create.rb +6 -1
- data/lib/marble_api_client/requests/index.rb +6 -1
- data/lib/marble_api_client/responses/bad_request.rb +3 -10
- data/lib/marble_api_client/responses/body_attributes.rb +44 -0
- data/lib/marble_api_client/responses/client_error.rb +2 -1
- data/lib/marble_api_client/responses/forbidden.rb +3 -14
- data/lib/marble_api_client/responses/http_methods.rb +1 -7
- data/lib/marble_api_client/responses/list.rb +5 -45
- data/lib/marble_api_client/responses/not_found.rb +3 -10
- data/lib/marble_api_client/responses/not_implemented.rb +3 -10
- data/lib/marble_api_client/responses/record.rb +3 -10
- data/lib/marble_api_client/responses/server_error.rb +3 -6
- data/lib/marble_api_client/responses/success.rb +2 -1
- data/lib/marble_api_client/responses/unauthorized.rb +3 -4
- data/lib/marble_api_client/responses/unprocessable_entity.rb +3 -25
- data/lib/marble_api_client/responses.rb +36 -8
- data/lib/marble_api_client/version.rb +1 -1
- data/lib/marble_api_client.rb +7 -1
- data/marble_api_client.gemspec +8 -6
- data/spec/marble_api_client/{proxy_spec.rb → client_spec.rb} +47 -16
- data/spec/marble_api_client/responses/bad_request_spec.rb +5 -5
- data/spec/marble_api_client/responses/forbidden_spec.rb +5 -5
- data/spec/marble_api_client/responses/list_spec.rb +8 -8
- data/spec/marble_api_client/responses/not_found_spec.rb +5 -5
- data/spec/marble_api_client/responses/not_implmented_spec.rb +1 -1
- data/spec/marble_api_client/responses/record_spec.rb +1 -1
- data/spec/marble_api_client/responses/responses_spec.rb +37 -23
- data/spec/marble_api_client/responses/server_error_spec.rb +1 -1
- data/spec/marble_api_client/responses/unauthorized_spec.rb +18 -0
- data/spec/marble_api_client/responses/unprocessable_entity_spec.rb +4 -4
- data/spec/marble_api_client_spec.rb +5 -0
- metadata +37 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af8b15a6c6b9c8f924514faec3239174d940a8f743f38f727d80256d5ecd5a29
|
4
|
+
data.tar.gz: 239322b12d457693d46e24c0a75f9b8940b726303732b8c033fba0cc41c98bae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65923ab69c544e910658e1aa6286f226f3e84ef21fa58be694991bc63cf3cca21d563bd88c27605449448e3e2e5edcd0b85913798583e6d116daac90ff9437db
|
7
|
+
data.tar.gz: d5e6ea846c798e7d6911906b1425b5c46ca2bb4c3328e33c93dcc72cbf97034bdd1592cf0078dc5662229ea863164f3468d7d7cdb04e4e88ac13e89a24bdb87d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.5
|
data/.travis.yml
CHANGED
@@ -4,10 +4,9 @@ env:
|
|
4
4
|
language: ruby
|
5
5
|
rvm:
|
6
6
|
# Build on the latest stable of all supported Rubies (https://www.ruby-lang.org/en/downloads/):
|
7
|
-
- 2.
|
8
|
-
- 2.
|
9
|
-
- 2.
|
10
|
-
- 2.6.3
|
7
|
+
- 2.4.9
|
8
|
+
- 2.5.7
|
9
|
+
- 2.6.5
|
11
10
|
cache: bundler
|
12
11
|
before_script:
|
13
12
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
@@ -15,7 +14,7 @@ before_script:
|
|
15
14
|
- ./cc-test-reporter before-build
|
16
15
|
script:
|
17
16
|
- bundle exec rubocop
|
18
|
-
- bundle exec rspec spec
|
17
|
+
- bundle exec rspec spec
|
19
18
|
after_script:
|
20
19
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
21
20
|
addons:
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/fba9ec43303ca1595e5a/maintainability)](https://codeclimate.com/github/bluemarblepayroll/marble_api_client/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/fba9ec43303ca1595e5a/test_coverage)](https://codeclimate.com/github/bluemarblepayroll/marble_api_client/test_coverage)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
5
5
|
|
6
6
|
|
7
|
-
This library
|
7
|
+
This library exists to simplify requests made to Marble Service Model (Still in progress). It offers simple objects to comply with the Marble Service Model request and response objects.
|
8
8
|
The library currently supports:
|
9
9
|
|
10
10
|
* Create
|
@@ -28,14 +28,12 @@ bundle add marble_api_client
|
|
28
28
|
|
29
29
|
### Creating the client
|
30
30
|
|
31
|
-
A client can be created with a
|
32
|
-
in all requests.
|
31
|
+
A client can be created with a URL and any headers that should be included
|
32
|
+
in all requests. By default, Content-Type of Application/JSON is added.
|
33
33
|
````ruby
|
34
|
-
client = MarbleApiClient
|
35
|
-
'https://www.example.com:3000'
|
36
|
-
headers: { 'Content-Type': 'application/json' }
|
34
|
+
client = MarbleApiClient.client(
|
35
|
+
'https://www.example.com:3000'
|
37
36
|
)
|
38
|
-
|
39
37
|
````
|
40
38
|
|
41
39
|
### Making Request Objects
|
@@ -8,26 +8,26 @@
|
|
8
8
|
#
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
|
-
# Main class for sending
|
11
|
+
# Main class for sending HTTP requests to a URL.
|
12
12
|
# Requests are sent using request and response objects crafted for each action.
|
13
13
|
# Headers can be provided to the Proxy as default headers for all requests
|
14
|
-
class
|
14
|
+
class Client
|
15
15
|
def initialize(base_url, headers: {})
|
16
16
|
raise ArgumentError, 'Base URL is not valid' unless base_url_valid?(base_url)
|
17
17
|
|
18
18
|
@base_url = base_url
|
19
|
-
@headers = headers
|
19
|
+
@headers = { 'Content-Type': 'application/json' }.merge(headers)
|
20
20
|
freeze
|
21
21
|
end
|
22
22
|
|
23
23
|
def create(path, create_request: Requests::Create.new, headers: {})
|
24
|
-
response = send_request(path, create_request, headers, 'create')
|
25
|
-
Responses.
|
24
|
+
response = send_request(path, Requests::Create.make(create_request), headers, 'create')
|
25
|
+
Responses.parse_response(response, Responses::CREATE_ACTION)
|
26
26
|
end
|
27
27
|
|
28
28
|
def index(path, index_request: Requests::Index.new, headers: {})
|
29
|
-
response = send_request(path, index_request, headers, 'index')
|
30
|
-
Responses.
|
29
|
+
response = send_request(path, Requests::Index.make(index_request), headers, 'index')
|
30
|
+
Responses.parse_response(response, Responses::INDEX_ACTION)
|
31
31
|
end
|
32
32
|
|
33
33
|
private
|
@@ -38,7 +38,7 @@ module MarbleApiClient
|
|
38
38
|
|
39
39
|
Net::HTTP.start(uri.host, uri.port, use_ssl: ssl?(uri)) do |http|
|
40
40
|
request = Net::HTTP::Post.new(uri.request_uri)
|
41
|
-
merged_headers.each { |key, value| request.add_field(key, value) }
|
41
|
+
merged_headers.each { |key, value| request.add_field(key.to_s, value.to_s) }
|
42
42
|
request.body = request_object.request_body
|
43
43
|
http.request(request)
|
44
44
|
end
|
@@ -57,12 +57,10 @@ module MarbleApiClient
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def base_url_valid?(url)
|
60
|
-
uri =
|
61
|
-
URI.parse(url)
|
62
|
-
rescue URI::InvalidURIError
|
63
|
-
false
|
64
|
-
end
|
60
|
+
uri = URI.parse(url)
|
65
61
|
uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)
|
62
|
+
rescue URI::InvalidURIError
|
63
|
+
false
|
66
64
|
end
|
67
65
|
end
|
68
66
|
end
|
@@ -9,11 +9,16 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Requests
|
12
|
-
#
|
12
|
+
# Request object for sending create requests.
|
13
|
+
# Uses context and record to send data that
|
14
|
+
# the service model can use in controllers
|
13
15
|
class Create
|
16
|
+
acts_as_hashable
|
17
|
+
|
14
18
|
def initialize(context: {}, record: {})
|
15
19
|
@context = context
|
16
20
|
@record = record
|
21
|
+
freeze
|
17
22
|
end
|
18
23
|
|
19
24
|
def request_body
|
@@ -9,13 +9,18 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Requests
|
12
|
-
#
|
12
|
+
# Request object for sending index requests.
|
13
|
+
# Uses context, record, page, and page_size to send
|
14
|
+
# data that the service model can use in controllers
|
13
15
|
class Index
|
16
|
+
acts_as_hashable
|
17
|
+
|
14
18
|
def initialize(context: {}, record: {}, page: 1, page_size: 25)
|
15
19
|
@context = context
|
16
20
|
@record = record
|
17
21
|
@page = page
|
18
22
|
@page_size = page_size
|
23
|
+
freeze
|
19
24
|
end
|
20
25
|
|
21
26
|
def request_body
|
@@ -9,17 +9,10 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
# 400
|
12
|
+
# Represents an HTTP 400 responses.
|
13
|
+
# Adds additional properties to the ClientError which encompasses the entire 400 level.
|
13
14
|
class BadRequest < ClientError
|
14
|
-
|
15
|
-
|
16
|
-
def initialize(response)
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
def errors
|
21
|
-
parsed_body.dig(ERRORS)
|
22
|
-
end
|
15
|
+
body_attributes :message
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
|
5
|
+
#
|
6
|
+
# This source code is licensed under the MIT license found in the
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
8
|
+
#
|
9
|
+
|
10
|
+
module MarbleApiClient
|
11
|
+
module Responses
|
12
|
+
# Allows for declarative body attribute naming in response classes
|
13
|
+
module BodyAttributes
|
14
|
+
class << self
|
15
|
+
def included(klass)
|
16
|
+
klass.extend(ClassMethods)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Extending ClassMethods to allow for module level class methods
|
21
|
+
module ClassMethods
|
22
|
+
def body_attributes(*keys)
|
23
|
+
keys.each do |k|
|
24
|
+
define_method(k) do
|
25
|
+
parsed_body.dig(json_key(k))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def json_key(key)
|
34
|
+
key.to_s.split('_').instance_eval do |k|
|
35
|
+
[k.first] + k.drop(1).map(&:capitalize)
|
36
|
+
end.join
|
37
|
+
end
|
38
|
+
|
39
|
+
def parsed_body
|
40
|
+
@parsed_body ||= JSON.parse(body)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -9,9 +9,10 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
# 400
|
12
|
+
# Represents an HTTP 400 response. This will encompass all errors in the 400-499 range.
|
13
13
|
class ClientError
|
14
14
|
include HttpMethods
|
15
|
+
include BodyAttributes
|
15
16
|
|
16
17
|
def initialize(response)
|
17
18
|
@response = response
|
@@ -9,21 +9,10 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
# 403
|
12
|
+
# Represents an HTTP 403 responses.
|
13
|
+
# Adds additional properties to the ClientError which encompasses the entire 400 level.
|
13
14
|
class Forbidden < ClientError
|
14
|
-
|
15
|
-
REDIRECT_URL = 'redirectUrl'
|
16
|
-
def initialize(response)
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
def status_code
|
21
|
-
parsed_body.dig(STATUS_CODE)
|
22
|
-
end
|
23
|
-
|
24
|
-
def redirect_url
|
25
|
-
parsed_body.dig(REDIRECT_URL)
|
26
|
-
end
|
15
|
+
body_attributes :message, :redirect_url
|
27
16
|
end
|
28
17
|
end
|
29
18
|
end
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
#
|
12
|
+
# This module requires a "response" method which returns an instance of Net::HTTPResponse.
|
13
13
|
module HttpMethods
|
14
14
|
def code
|
15
15
|
@response.code
|
@@ -18,12 +18,6 @@ module MarbleApiClient
|
|
18
18
|
def body
|
19
19
|
@response.body
|
20
20
|
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def parsed_body
|
25
|
-
@parsed_body ||= JSON.parse(body)
|
26
|
-
end
|
27
21
|
end
|
28
22
|
end
|
29
23
|
end
|
@@ -9,52 +9,12 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
#
|
12
|
+
# Represents an HTTP 200 responses.
|
13
|
+
# Adds additional properties to the Success class specific to Index requests.
|
13
14
|
class List < Success
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
RECORDS = 'records'
|
18
|
-
SORT_DIRECTION = 'sortDirection'
|
19
|
-
SORT_COLUMN_INDEX = 'sortColumnIndex'
|
20
|
-
TOTAL = 'total'
|
21
|
-
TOTAL_PAGES = 'totalPages'
|
22
|
-
|
23
|
-
def initialize(response)
|
24
|
-
super
|
25
|
-
end
|
26
|
-
|
27
|
-
def page
|
28
|
-
parsed_body.dig(PAGE)
|
29
|
-
end
|
30
|
-
|
31
|
-
def page_size
|
32
|
-
parsed_body.dig(PAGE_SIZE)
|
33
|
-
end
|
34
|
-
|
35
|
-
def meta
|
36
|
-
parsed_body.dig(META)
|
37
|
-
end
|
38
|
-
|
39
|
-
def records
|
40
|
-
parsed_body.dig(RECORDS)
|
41
|
-
end
|
42
|
-
|
43
|
-
def sort_direction
|
44
|
-
parsed_body.dig(SORT_DIRECTION)
|
45
|
-
end
|
46
|
-
|
47
|
-
def sort_column_index
|
48
|
-
parsed_body.dig(SORT_COLUMN_INDEX)
|
49
|
-
end
|
50
|
-
|
51
|
-
def total
|
52
|
-
parsed_body.dig(TOTAL)
|
53
|
-
end
|
54
|
-
|
55
|
-
def total_pages
|
56
|
-
parsed_body.dig(TOTAL_PAGES)
|
57
|
-
end
|
15
|
+
body_attributes :page, :page_size, :meta, :records,
|
16
|
+
:sort_direction, :sort_column_index,
|
17
|
+
:total, :total_pages
|
58
18
|
end
|
59
19
|
end
|
60
20
|
end
|
@@ -9,17 +9,10 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
# 404
|
12
|
+
# Represents an HTTP 404 responses.
|
13
|
+
# Adds additional properties to the ClientError which encompasses the entire 400 level.
|
13
14
|
class NotFound < ClientError
|
14
|
-
|
15
|
-
|
16
|
-
def initialize(response)
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
def errors
|
21
|
-
parsed_body.dig(ERRORS)
|
22
|
-
end
|
15
|
+
body_attributes :message
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -8,17 +8,10 @@
|
|
8
8
|
#
|
9
9
|
module MarbleApiClient
|
10
10
|
module Responses
|
11
|
-
# 501
|
11
|
+
# Represents an HTTP 501 responses.
|
12
|
+
# Adds additional properties to the ServerError which encompasses the entire 500 level.
|
12
13
|
class NotImplemented < ServerError
|
13
|
-
|
14
|
-
|
15
|
-
def initialize(response)
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
def errors
|
20
|
-
parsed_body.dig(ERRORS)
|
21
|
-
end
|
14
|
+
body_attributes :message
|
22
15
|
end
|
23
16
|
end
|
24
17
|
end
|
@@ -9,17 +9,10 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
#
|
12
|
+
# Represents an HTTP 200 responses.
|
13
|
+
# Adds additional properties to the Success class specific to Create requests.
|
13
14
|
class Record < Success
|
14
|
-
|
15
|
-
|
16
|
-
def initialize(response)
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
def record
|
21
|
-
parsed_body.dig(RECORD)
|
22
|
-
end
|
15
|
+
body_attributes :record
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -9,19 +9,16 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
# 500
|
12
|
+
# Represents an HTTP 500 response. This will encompass all errors in the 500-599 range.
|
13
13
|
class ServerError
|
14
14
|
include HttpMethods
|
15
|
+
include BodyAttributes
|
15
16
|
|
16
|
-
|
17
|
+
body_attributes :errors
|
17
18
|
|
18
19
|
def initialize(response)
|
19
20
|
@response = response
|
20
21
|
end
|
21
|
-
|
22
|
-
def errors
|
23
|
-
parsed_body.dig(ERRORS)
|
24
|
-
end
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -9,9 +9,10 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
# 200
|
12
|
+
# Represents an HTTP 200 response. This will encompass all errors in the 200-299 range.
|
13
13
|
class Success
|
14
14
|
include HttpMethods
|
15
|
+
include BodyAttributes
|
15
16
|
|
16
17
|
def initialize(response)
|
17
18
|
@response = response
|
@@ -9,11 +9,10 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
# 401
|
12
|
+
# Represents an HTTP 401 responses.
|
13
|
+
# Adds additional properties to the ClientError which encompasses the entire 400 level.
|
13
14
|
class Unauthorized < ClientError
|
14
|
-
|
15
|
-
super
|
16
|
-
end
|
15
|
+
body_attributes :message, :redirect_url
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
@@ -9,32 +9,10 @@
|
|
9
9
|
|
10
10
|
module MarbleApiClient
|
11
11
|
module Responses
|
12
|
-
# 422
|
12
|
+
# Represents an HTTP 422 responses.
|
13
|
+
# Adds additional properties to the ClientError which encompasses the entire 400 level.
|
13
14
|
class UnprocessableEntity < ClientError
|
14
|
-
|
15
|
-
ERROR_PROPERTIES = 'errorProperties'
|
16
|
-
WARNINGS = 'warnings'
|
17
|
-
WARNING_PROPERTIES = 'warningProperties'
|
18
|
-
|
19
|
-
def initialize(response)
|
20
|
-
super
|
21
|
-
end
|
22
|
-
|
23
|
-
def errors
|
24
|
-
parsed_body.dig(ERRORS)
|
25
|
-
end
|
26
|
-
|
27
|
-
def error_properties
|
28
|
-
parsed_body.dig(ERROR_PROPERTIES)
|
29
|
-
end
|
30
|
-
|
31
|
-
def warnings
|
32
|
-
parsed_body.dig(WARNINGS)
|
33
|
-
end
|
34
|
-
|
35
|
-
def warning_properties
|
36
|
-
parsed_body.dig(WARNING_PROPERTIES)
|
37
|
-
end
|
15
|
+
body_attributes :errors, :error_properties, :warnings, :warning_properties
|
38
16
|
end
|
39
17
|
end
|
40
18
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'responses/http_methods'
|
4
|
+
require_relative 'responses/body_attributes'
|
4
5
|
|
5
6
|
require_relative 'responses/success'
|
6
7
|
require_relative 'responses/client_error'
|
@@ -16,7 +17,7 @@ require_relative 'responses/unauthorized'
|
|
16
17
|
require_relative 'responses/unprocessable_entity'
|
17
18
|
|
18
19
|
module MarbleApiClient
|
19
|
-
# Module for
|
20
|
+
# Module for getting response objects
|
20
21
|
module Responses
|
21
22
|
INDEX_ACTION = 'index'
|
22
23
|
CREATE_ACTION = 'create'
|
@@ -31,6 +32,10 @@ module MarbleApiClient
|
|
31
32
|
NOT_IMPLEMENTED_RESPONSE_CODE = '501'
|
32
33
|
|
33
34
|
RESPONSES = [
|
35
|
+
{
|
36
|
+
code: SUCCESS_RESPONSE_CODE,
|
37
|
+
class_constant: Success
|
38
|
+
},
|
34
39
|
{
|
35
40
|
code: SUCCESS_RESPONSE_CODE,
|
36
41
|
action: INDEX_ACTION,
|
@@ -72,20 +77,43 @@ module MarbleApiClient
|
|
72
77
|
].freeze
|
73
78
|
|
74
79
|
class << self
|
75
|
-
def
|
80
|
+
def parse_response(response, action)
|
76
81
|
raise ArgumentError, 'HTTPResponse required' unless response.is_a?(Net::HTTPResponse)
|
77
82
|
|
78
|
-
|
83
|
+
find_object(response, action)[:class_constant].new(response)
|
84
|
+
end
|
79
85
|
|
80
|
-
|
86
|
+
private
|
81
87
|
|
82
|
-
|
88
|
+
def find_object(response, action)
|
89
|
+
code_search = create_searches(response.code)
|
90
|
+
find_by_code_and_action(response.code, action, code_search)
|
83
91
|
end
|
84
92
|
|
85
|
-
|
86
|
-
|
87
|
-
|
93
|
+
# Creates cascading searches using lambdas and the find ifnone argument.
|
94
|
+
# Shortcircuits at first found object and returns it.
|
95
|
+
def create_searches(code)
|
96
|
+
none_found = lambda do
|
97
|
+
raise ArgumentError, "Unexpecred HTTResponse: #{code}"
|
98
|
+
end
|
99
|
+
|
100
|
+
rounded_code_search = lambda do
|
101
|
+
RESPONSES.find(none_found) { |r| r[:action].nil? && r[:code] == rounded_code(code) }
|
88
102
|
end
|
103
|
+
|
104
|
+
lambda do
|
105
|
+
RESPONSES.find(rounded_code_search) { |r| r[:action].nil? && r[:code] == code }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def find_by_code_and_action(code, action, ifnone)
|
110
|
+
RESPONSES.find(ifnone) do |r|
|
111
|
+
r[:code] == code && r[:action] == action
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def rounded_code(code)
|
116
|
+
code.to_i.floor(-2).to_s
|
89
117
|
end
|
90
118
|
end
|
91
119
|
end
|
data/lib/marble_api_client.rb
CHANGED
@@ -8,11 +8,17 @@
|
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'net/http'
|
11
|
+
require 'acts_as_hashable'
|
11
12
|
|
12
|
-
require_relative 'marble_api_client/
|
13
|
+
require_relative 'marble_api_client/client'
|
13
14
|
require_relative 'marble_api_client/requests'
|
14
15
|
require_relative 'marble_api_client/responses'
|
15
16
|
|
16
17
|
# This class interacts with Blue Marble Payroll Webglobe API
|
17
18
|
module MarbleApiClient
|
19
|
+
class << self
|
20
|
+
def client(base_url, headers: {})
|
21
|
+
Client.new(base_url, headers)
|
22
|
+
end
|
23
|
+
end
|
18
24
|
end
|
data/marble_api_client.gemspec
CHANGED
@@ -19,14 +19,16 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.homepage = 'https://github.com/bluemarblepayroll/marble_api_client'
|
20
20
|
s.license = 'MIT'
|
21
21
|
|
22
|
-
s.required_ruby_version = '>= 2.3.8'
|
22
|
+
s.required_ruby_version = '>= 2.3.8', '<2.7.0'
|
23
|
+
|
24
|
+
s.add_dependency 'acts_as_hashable', '~> 1'
|
23
25
|
|
24
26
|
s.add_development_dependency('guard-rspec', '~>4.7')
|
25
27
|
s.add_development_dependency('pry', '~>0')
|
26
28
|
s.add_development_dependency('rake', '~> 12')
|
27
|
-
s.add_development_dependency('rspec')
|
28
|
-
s.add_development_dependency('rubocop', '~>0.74
|
29
|
-
s.add_development_dependency('simplecov', '~>0.17
|
30
|
-
s.add_development_dependency('simplecov-console', '~>0.5
|
31
|
-
s.add_development_dependency('webmock')
|
29
|
+
s.add_development_dependency('rspec', '~>3.8')
|
30
|
+
s.add_development_dependency('rubocop', '~>0.74')
|
31
|
+
s.add_development_dependency('simplecov', '~>0.17')
|
32
|
+
s.add_development_dependency('simplecov-console', '~>0.5')
|
33
|
+
s.add_development_dependency('webmock', '~>3.7')
|
32
34
|
end
|
@@ -9,21 +9,20 @@
|
|
9
9
|
|
10
10
|
require 'spec_helper'
|
11
11
|
|
12
|
-
RSpec.describe MarbleApiClient::
|
13
|
-
let(:
|
14
|
-
MarbleApiClient::
|
15
|
-
'http://www.example.com:3000'
|
16
|
-
headers: { 'Content-Type': 'application/json' }
|
12
|
+
RSpec.describe MarbleApiClient::Client do
|
13
|
+
let(:client) do
|
14
|
+
MarbleApiClient::Client.new(
|
15
|
+
'http://www.example.com:3000'
|
17
16
|
)
|
18
17
|
end
|
19
18
|
|
20
19
|
it 'requires a base_url' do
|
21
|
-
expect { MarbleApiClient::
|
20
|
+
expect { MarbleApiClient::Client.new(nil) }
|
22
21
|
.to raise_error(ArgumentError, 'Base URL is not valid')
|
23
22
|
end
|
24
23
|
|
25
24
|
it 'uses SSL for HTTPS requests' do
|
26
|
-
p = MarbleApiClient::
|
25
|
+
p = MarbleApiClient::Client.new(
|
27
26
|
'https://www.example.com:3000',
|
28
27
|
headers: { 'Content-Type': 'application/json' }
|
29
28
|
)
|
@@ -36,19 +35,35 @@ RSpec.describe MarbleApiClient::Proxy do
|
|
36
35
|
context 'create' do
|
37
36
|
it 'sends requests to path' do
|
38
37
|
stub_request(:post, 'http://www.example.com:3000/custom/path/create')
|
39
|
-
|
38
|
+
client.create('custom/path')
|
40
39
|
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/create')
|
41
40
|
end
|
42
41
|
|
43
42
|
it 'sends requests to path ending in "/"' do
|
44
43
|
stub_request(:post, 'http://www.example.com:3000/custom/path/create')
|
45
|
-
|
44
|
+
client.create('custom/path/')
|
46
45
|
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/create')
|
47
46
|
end
|
48
47
|
|
49
48
|
it 'sends correct headers' do
|
50
49
|
stub_request(:post, 'http://www.example.com:3000/custom/path/create')
|
51
|
-
|
50
|
+
client.create('custom/path', headers: { option: 'val' })
|
51
|
+
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/create')
|
52
|
+
.with(headers: { 'Content-Type': 'application/json',
|
53
|
+
option: 'val' })
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'sends symbol headers' do
|
57
|
+
stub_request(:post, 'http://www.example.com:3000/custom/path/create')
|
58
|
+
client.create('custom/path', headers: { option: 'val' })
|
59
|
+
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/create')
|
60
|
+
.with(headers: { 'Content-Type': 'application/json',
|
61
|
+
option: 'val' })
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'sends string headers' do
|
65
|
+
stub_request(:post, 'http://www.example.com:3000/custom/path/create')
|
66
|
+
client.create('custom/path', headers: { 'option' => 'val' })
|
52
67
|
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/create')
|
53
68
|
.with(headers: { 'Content-Type': 'application/json',
|
54
69
|
option: 'val' })
|
@@ -56,8 +71,16 @@ RSpec.describe MarbleApiClient::Proxy do
|
|
56
71
|
|
57
72
|
it 'sends the correct body' do
|
58
73
|
stub_request(:post, 'http://www.example.com:3000/custom/path/create')
|
59
|
-
|
60
|
-
|
74
|
+
client.create('custom/path',
|
75
|
+
create_request: MarbleApiClient::Requests::Create.new(record: { name: 'blue' }))
|
76
|
+
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/create')
|
77
|
+
.with(body: { context: {}, record: { name: 'blue' } })
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'allows hash instead of Request::Create object' do
|
81
|
+
stub_request(:post, 'http://www.example.com:3000/custom/path/create')
|
82
|
+
client.create('custom/path',
|
83
|
+
create_request: { record: { name: 'blue' } })
|
61
84
|
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/create')
|
62
85
|
.with(body: { context: {}, record: { name: 'blue' } })
|
63
86
|
end
|
@@ -66,13 +89,13 @@ RSpec.describe MarbleApiClient::Proxy do
|
|
66
89
|
context 'index' do
|
67
90
|
it 'sends to requested path' do
|
68
91
|
stub_request(:post, 'http://www.example.com:3000/custom/path/index')
|
69
|
-
|
92
|
+
client.index('custom/path')
|
70
93
|
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/index')
|
71
94
|
end
|
72
95
|
|
73
96
|
it 'sends the correct headers' do
|
74
97
|
stub_request(:post, 'http://www.example.com:3000/custom/path/index')
|
75
|
-
|
98
|
+
client.index('custom/path', headers: { option: 'val' })
|
76
99
|
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/index')
|
77
100
|
.with(headers: { 'Content-Type': 'application/json',
|
78
101
|
option: 'val' })
|
@@ -80,8 +103,16 @@ RSpec.describe MarbleApiClient::Proxy do
|
|
80
103
|
|
81
104
|
it 'sends the correct body' do
|
82
105
|
stub_request(:post, 'http://www.example.com:3000/custom/path/index')
|
83
|
-
|
84
|
-
|
106
|
+
client.index('custom/path',
|
107
|
+
index_request: MarbleApiClient::Requests::Index.new(record: { name: 'blue' }))
|
108
|
+
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/index')
|
109
|
+
.with(body: { context: {}, record: { name: 'blue' }, page: 1, page_size: 25 })
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'allows hash instead of Request::Index object' do
|
113
|
+
stub_request(:post, 'http://www.example.com:3000/custom/path/index')
|
114
|
+
client.index('custom/path',
|
115
|
+
index_request: { record: { name: 'blue' } })
|
85
116
|
expect(WebMock).to have_requested(:post, 'http://www.example.com:3000/custom/path/index')
|
86
117
|
.with(body: { context: {}, record: { name: 'blue' }, page: 1, page_size: 25 })
|
87
118
|
end
|
@@ -11,14 +11,14 @@ require 'spec_helper'
|
|
11
11
|
|
12
12
|
RSpec.describe MarbleApiClient::Responses::BadRequest do
|
13
13
|
context 'provides' do
|
14
|
-
let(:
|
14
|
+
let(:message) { 'invalid' }
|
15
15
|
let(:response) do
|
16
|
-
instance_double(Net::HTTPResponse, code: 400, body: {
|
16
|
+
instance_double(Net::HTTPResponse, code: 400, body: { message: message }.to_json)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
expect(described_class.new(response).
|
21
|
-
.to eq(
|
19
|
+
specify 'message' do
|
20
|
+
expect(described_class.new(response).message)
|
21
|
+
.to eq(message)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -14,16 +14,16 @@ RSpec.describe MarbleApiClient::Responses::Forbidden do
|
|
14
14
|
let(:response) do
|
15
15
|
instance_double(Net::HTTPResponse,
|
16
16
|
code: 400,
|
17
|
-
body: {
|
17
|
+
body: { message: 'not allowed',
|
18
18
|
redirectUrl: 'www.example.com/hello' }.to_json)
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
expect(described_class.new(response).
|
23
|
-
.to eq('
|
21
|
+
specify 'message' do
|
22
|
+
expect(described_class.new(response).message)
|
23
|
+
.to eq('not allowed')
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
specify 'Redirect URL' do
|
27
27
|
expect(described_class.new(response).redirect_url)
|
28
28
|
.to eq('www.example.com/hello')
|
29
29
|
end
|
@@ -34,42 +34,42 @@ RSpec.describe MarbleApiClient::Responses::List do
|
|
34
34
|
}.to_json)
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
specify 'page' do
|
38
38
|
expect(described_class.new(response).page)
|
39
39
|
.to eq(page)
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
specify 'page_size' do
|
43
43
|
expect(described_class.new(response).page_size)
|
44
44
|
.to eq(page_size)
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
specify 'meta' do
|
48
48
|
expect(described_class.new(response).meta)
|
49
49
|
.to eq(meta)
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
specify 'records' do
|
53
53
|
expect(described_class.new(response).records)
|
54
54
|
.to eq(records)
|
55
55
|
end
|
56
56
|
|
57
|
-
|
57
|
+
specify 'sort driection' do
|
58
58
|
expect(described_class.new(response).sort_direction)
|
59
59
|
.to eq(sort_direction)
|
60
60
|
end
|
61
61
|
|
62
|
-
|
62
|
+
specify 'sort column index' do
|
63
63
|
expect(described_class.new(response).sort_column_index)
|
64
64
|
.to eq(sort_column_index)
|
65
65
|
end
|
66
66
|
|
67
|
-
|
67
|
+
specify 'total' do
|
68
68
|
expect(described_class.new(response).total)
|
69
69
|
.to eq(total)
|
70
70
|
end
|
71
71
|
|
72
|
-
|
72
|
+
specify 'total pages' do
|
73
73
|
expect(described_class.new(response).total_pages)
|
74
74
|
.to eq(total_pages)
|
75
75
|
end
|
@@ -11,14 +11,14 @@ require 'spec_helper'
|
|
11
11
|
|
12
12
|
RSpec.describe MarbleApiClient::Responses::NotFound do
|
13
13
|
context 'provides' do
|
14
|
-
let(:
|
14
|
+
let(:message) { 'invalid' }
|
15
15
|
let(:response) do
|
16
|
-
instance_double(Net::HTTPResponse, code: 400, body: {
|
16
|
+
instance_double(Net::HTTPResponse, code: 400, body: { message: message }.to_json)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
expect(described_class.new(response).
|
21
|
-
.to eq(
|
19
|
+
specify 'errors' do
|
20
|
+
expect(described_class.new(response).message)
|
21
|
+
.to eq(message)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -16,7 +16,7 @@ RSpec.describe MarbleApiClient::Responses::NotImplemented do
|
|
16
16
|
instance_double(Net::HTTPResponse, code: 400, body: { errors: error_hash }.to_json)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
specify 'errors' do
|
20
20
|
expect(described_class.new(response).errors)
|
21
21
|
.to eq(error_hash)
|
22
22
|
end
|
@@ -12,79 +12,93 @@ require 'spec_helper'
|
|
12
12
|
RSpec.describe MarbleApiClient::Responses do
|
13
13
|
it 'requires a HTTPResponse' do
|
14
14
|
response = nil
|
15
|
-
expect { described_class.
|
15
|
+
expect { described_class.parse_response(response, 'index') }
|
16
16
|
.to raise_error(ArgumentError)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
describe 'objects returned for various HTTP status codes' do
|
20
|
+
specify '200' do
|
21
21
|
response = Net::HTTPResponse.new(1.0, '200', 'OK')
|
22
|
-
response.uri = 'www.exampleuri.com/
|
23
|
-
expect(described_class.
|
22
|
+
response.uri = 'www.exampleuri.com/notarealaction'
|
23
|
+
expect(described_class.parse_response(response, 'notarealaction'))
|
24
24
|
.to be_a_kind_of(MarbleApiClient::Responses::Success)
|
25
25
|
end
|
26
26
|
|
27
|
-
|
27
|
+
specify '200 Index' do
|
28
28
|
response = Net::HTTPResponse.new(1.0, '200', 'OK')
|
29
29
|
response.uri = 'www.exampleuri.com/index'
|
30
|
-
expect(described_class.
|
30
|
+
expect(described_class.parse_response(response, 'index'))
|
31
31
|
.to be_a_kind_of(MarbleApiClient::Responses::List)
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
specify '200 Create' do
|
35
35
|
response = Net::HTTPResponse.new(1.0, '200', 'OK')
|
36
36
|
response.uri = 'www.exampleuri.com/create'
|
37
|
-
expect(described_class.
|
37
|
+
expect(described_class.parse_response(response, 'create'))
|
38
38
|
.to be_a_kind_of(MarbleApiClient::Responses::Record)
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
specify '400' do
|
42
42
|
response = Net::HTTPResponse.new(1.0, '400', 'Client Error')
|
43
43
|
response.uri = 'www.exampleuri.com/index'
|
44
|
-
expect(described_class.
|
44
|
+
expect(described_class.parse_response(response, 'index'))
|
45
45
|
.to be_a_kind_of(MarbleApiClient::Responses::BadRequest)
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
specify '401' do
|
49
49
|
response = Net::HTTPResponse.new(1.0, '401', 'Client Error')
|
50
50
|
response.uri = 'www.exampleuri.com/index'
|
51
|
-
expect(described_class.
|
51
|
+
expect(described_class.parse_response(response, 'index'))
|
52
52
|
.to be_a_kind_of(MarbleApiClient::Responses::Unauthorized)
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
specify '403' do
|
56
56
|
response = Net::HTTPResponse.new(1.0, '403', 'Client Error')
|
57
57
|
response.uri = 'www.exampleuri.com/index'
|
58
|
-
expect(described_class.
|
58
|
+
expect(described_class.parse_response(response, 'index'))
|
59
59
|
.to be_a_kind_of(MarbleApiClient::Responses::Forbidden)
|
60
60
|
end
|
61
61
|
|
62
|
-
|
62
|
+
specify '404' do
|
63
63
|
response = Net::HTTPResponse.new(1.0, '404', 'Client Error')
|
64
64
|
response.uri = 'www.exampleuri.com/index'
|
65
|
-
expect(described_class.
|
65
|
+
expect(described_class.parse_response(response, 'index'))
|
66
66
|
.to be_a_kind_of(MarbleApiClient::Responses::NotFound)
|
67
67
|
end
|
68
68
|
|
69
|
-
|
69
|
+
specify '422' do
|
70
70
|
response = Net::HTTPResponse.new(1.0, '422', 'Client Error')
|
71
71
|
response.uri = 'www.exampleuri.com/index'
|
72
|
-
expect(described_class.
|
72
|
+
expect(described_class.parse_response(response, 'index'))
|
73
73
|
.to be_a_kind_of(MarbleApiClient::Responses::UnprocessableEntity)
|
74
74
|
end
|
75
75
|
|
76
|
-
|
76
|
+
specify '500' do
|
77
77
|
response = Net::HTTPResponse.new(1.0, '500', 'Server Error')
|
78
78
|
response.uri = 'www.exampleuri.com/index'
|
79
|
-
expect(described_class.
|
79
|
+
expect(described_class.parse_response(response, 'index'))
|
80
80
|
.to be_a_kind_of(MarbleApiClient::Responses::ServerError)
|
81
81
|
end
|
82
82
|
|
83
|
-
|
83
|
+
specify '501' do
|
84
84
|
response = Net::HTTPResponse.new(1.0, '501', 'Server Error')
|
85
85
|
response.uri = 'www.exampleuri.com/index'
|
86
|
-
expect(described_class.
|
86
|
+
expect(described_class.parse_response(response, 'index'))
|
87
87
|
.to be_a_kind_of(MarbleApiClient::Responses::NotImplemented)
|
88
88
|
end
|
89
|
+
|
90
|
+
specify '503' do
|
91
|
+
response = Net::HTTPResponse.new(1.0, '503', 'Server Error')
|
92
|
+
response.uri = 'www.exampleuri.com/index'
|
93
|
+
expect(described_class.parse_response(response, 'index'))
|
94
|
+
.to be_a_kind_of(MarbleApiClient::Responses::ServerError)
|
95
|
+
end
|
96
|
+
|
97
|
+
specify '1000' do
|
98
|
+
response = Net::HTTPResponse.new(1.0, '1000', 'Not Real Error')
|
99
|
+
response.uri = 'www.exampleuri.com/index'
|
100
|
+
expect { described_class.parse_response(response, 'index') }
|
101
|
+
.to raise_error(ArgumentError)
|
102
|
+
end
|
89
103
|
end
|
90
104
|
end
|
@@ -16,7 +16,7 @@ RSpec.describe MarbleApiClient::Responses::ServerError do
|
|
16
16
|
instance_double(Net::HTTPResponse, code: 400, body: { errors: error_hash }.to_json)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
specify 'errors' do
|
20
20
|
expect(described_class.new(response).errors)
|
21
21
|
.to eq(error_hash)
|
22
22
|
end
|
@@ -10,4 +10,22 @@
|
|
10
10
|
require 'spec_helper'
|
11
11
|
|
12
12
|
RSpec.describe MarbleApiClient::Responses::Unauthorized do
|
13
|
+
context 'provides' do
|
14
|
+
let(:response) do
|
15
|
+
instance_double(Net::HTTPResponse,
|
16
|
+
code: 400,
|
17
|
+
body: { message: 'not authorized',
|
18
|
+
redirectUrl: 'www.example.com/hello' }.to_json)
|
19
|
+
end
|
20
|
+
|
21
|
+
specify 'message' do
|
22
|
+
expect(described_class.new(response).message)
|
23
|
+
.to eq('not authorized')
|
24
|
+
end
|
25
|
+
|
26
|
+
specify 'Redirect URL' do
|
27
|
+
expect(described_class.new(response).redirect_url)
|
28
|
+
.to eq('www.example.com/hello')
|
29
|
+
end
|
30
|
+
end
|
13
31
|
end
|
@@ -26,22 +26,22 @@ RSpec.describe MarbleApiClient::Responses::UnprocessableEntity do
|
|
26
26
|
}.to_json)
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
specify 'errors' do
|
30
30
|
expect(described_class.new(response).errors)
|
31
31
|
.to eq(errors)
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
specify 'error properties' do
|
35
35
|
expect(described_class.new(response).error_properties)
|
36
36
|
.to eq(error_properties)
|
37
37
|
end
|
38
38
|
|
39
|
-
|
39
|
+
specify 'warnings' do
|
40
40
|
expect(described_class.new(response).warnings)
|
41
41
|
.to eq(warnings)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
specify 'warning properties' do
|
45
45
|
expect(described_class.new(response).warning_properties)
|
46
46
|
.to eq(warning_properties)
|
47
47
|
end
|
@@ -13,4 +13,9 @@ RSpec.describe MarbleApiClient do
|
|
13
13
|
it 'has a version number' do
|
14
14
|
expect(MarbleApiClient::VERSION).not_to be nil
|
15
15
|
end
|
16
|
+
|
17
|
+
specify 'client returns a MarbleApiClient::Client' do
|
18
|
+
expect(MarbleApiClient.client('http://www.example.com'))
|
19
|
+
.to be_a(MarbleApiClient::Client)
|
20
|
+
end
|
16
21
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marble_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.alpha
|
4
|
+
version: 1.0.0.pre.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Dewar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: acts_as_hashable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: guard-rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,72 +70,72 @@ dependencies:
|
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '3.8'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '3.8'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.74
|
89
|
+
version: '0.74'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.74
|
96
|
+
version: '0.74'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: simplecov
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.17
|
103
|
+
version: '0.17'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.17
|
110
|
+
version: '0.17'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: simplecov-console
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.5
|
117
|
+
version: '0.5'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.5
|
124
|
+
version: '0.5'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: webmock
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- - "
|
129
|
+
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
131
|
+
version: '3.7'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- - "
|
136
|
+
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
138
|
+
version: '3.7'
|
125
139
|
description: " Write a description.\n"
|
126
140
|
email:
|
127
141
|
- ddewar@bluemarblepayroll.com
|
@@ -144,12 +158,13 @@ files:
|
|
144
158
|
- Rakefile
|
145
159
|
- bin/console
|
146
160
|
- lib/marble_api_client.rb
|
147
|
-
- lib/marble_api_client/
|
161
|
+
- lib/marble_api_client/client.rb
|
148
162
|
- lib/marble_api_client/requests.rb
|
149
163
|
- lib/marble_api_client/requests/create.rb
|
150
164
|
- lib/marble_api_client/requests/index.rb
|
151
165
|
- lib/marble_api_client/responses.rb
|
152
166
|
- lib/marble_api_client/responses/bad_request.rb
|
167
|
+
- lib/marble_api_client/responses/body_attributes.rb
|
153
168
|
- lib/marble_api_client/responses/client_error.rb
|
154
169
|
- lib/marble_api_client/responses/forbidden.rb
|
155
170
|
- lib/marble_api_client/responses/http_methods.rb
|
@@ -163,7 +178,7 @@ files:
|
|
163
178
|
- lib/marble_api_client/responses/unprocessable_entity.rb
|
164
179
|
- lib/marble_api_client/version.rb
|
165
180
|
- marble_api_client.gemspec
|
166
|
-
- spec/marble_api_client/
|
181
|
+
- spec/marble_api_client/client_spec.rb
|
167
182
|
- spec/marble_api_client/requests/create_spec.rb
|
168
183
|
- spec/marble_api_client/requests/index_spec.rb
|
169
184
|
- spec/marble_api_client/responses/bad_request_spec.rb
|
@@ -193,6 +208,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
208
|
- - ">="
|
194
209
|
- !ruby/object:Gem::Version
|
195
210
|
version: 2.3.8
|
211
|
+
- - "<"
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: 2.7.0
|
196
214
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
215
|
requirements:
|
198
216
|
- - ">"
|
@@ -204,7 +222,7 @@ signing_key:
|
|
204
222
|
specification_version: 4
|
205
223
|
summary: Write a summary.
|
206
224
|
test_files:
|
207
|
-
- spec/marble_api_client/
|
225
|
+
- spec/marble_api_client/client_spec.rb
|
208
226
|
- spec/marble_api_client/requests/create_spec.rb
|
209
227
|
- spec/marble_api_client/requests/index_spec.rb
|
210
228
|
- spec/marble_api_client/responses/bad_request_spec.rb
|