fulfil_api 0.1.3 → 0.1.4
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 +4 -4
- data/README.md +2 -0
- data/lib/fulfil_api/client.rb +5 -2
- data/lib/fulfil_api/configuration.rb +6 -2
- data/lib/fulfil_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f8ba18240c4cbc9a772505388ca2cc1c86a5afbe6b68e28c2244d622cc2d827
|
4
|
+
data.tar.gz: a6c6864e7b9753cfb0e92c72940effc3b6b9d14845616941e63ea909c2ffe042
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a6942e7212111fc5a0f62aed933a9b290c21d495588894487271623f6f2fcb767fbaaf5ccca4aa941063903934d676207af00b56ea705c32c2ee59d542f5e68
|
7
|
+
data.tar.gz: 94a91fc36310e2ad898605972262f94762c075754c74c3711762fc83400ba111b19585bd97c655dc9092dd5ab1e9d6bce6c6d465d882cbc308c20af1d0818895
|
data/README.md
CHANGED
@@ -60,6 +60,8 @@ The following configuration options are (currently) available throught both conf
|
|
60
60
|
|
61
61
|
- `merchant_id` (`String`): The `merchant_id` is the subdomain that the Fulfil instance is hosted on. This configuration option is required to be able to query Fulfil's API endpoints.
|
62
62
|
|
63
|
+
- `request_options` (`Hash`): The `request_options` are the configuration options for the HTTP client. See [https://lostisland.github.io/faraday/#/customization/request-options](https://lostisland.github.io/faraday/#/customization/request-options) in `faraday`.
|
64
|
+
|
63
65
|
### Querying the Fulfil API
|
64
66
|
|
65
67
|
> **NOTE:** Currently, the gem is under heavy development. The querying interface of the gem is really basic at the moment. In the future, we will closer match the querying interface of `ActiveRecord`.
|
data/lib/fulfil_api/client.rb
CHANGED
@@ -58,8 +58,11 @@ module FulfilApi
|
|
58
58
|
|
59
59
|
# @return [Faraday::Connection]
|
60
60
|
def connection
|
61
|
-
|
62
|
-
|
61
|
+
@connection ||= Faraday.new(
|
62
|
+
headers: request_headers,
|
63
|
+
url: api_endpoint,
|
64
|
+
request: configuration.request_options
|
65
|
+
) do |connection|
|
63
66
|
connection.adapter :net_http_persistent # TODO: Allow passing configuration options
|
64
67
|
|
65
68
|
# Configuration of the request middleware
|
@@ -6,7 +6,10 @@ module FulfilApi
|
|
6
6
|
# This model holds configuration settings and provides thread-safe access
|
7
7
|
# to these settings.
|
8
8
|
class Configuration
|
9
|
-
attr_accessor :access_token, :api_version, :merchant_id
|
9
|
+
attr_accessor :access_token, :api_version, :merchant_id, :request_options
|
10
|
+
|
11
|
+
DEFAULT_API_VERSION = "v2"
|
12
|
+
DEFAULT_REQUEST_OPTIONS = { open_timeout: 1, read_timeout: 5, write_timeout: 5, timeout: 5 }.freeze
|
10
13
|
|
11
14
|
# Initializes the configuration with optional settings.
|
12
15
|
#
|
@@ -52,7 +55,8 @@ module FulfilApi
|
|
52
55
|
#
|
53
56
|
# @return [void]
|
54
57
|
def set_default_options
|
55
|
-
self.api_version =
|
58
|
+
self.api_version = DEFAULT_API_VERSION if api_version.nil?
|
59
|
+
self.request_options = DEFAULT_REQUEST_OPTIONS if request_options.nil?
|
56
60
|
end
|
57
61
|
end
|
58
62
|
|
data/lib/fulfil_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fulfil_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Vermaas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|