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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a281b6b98a2a9e17e00dfcfc9a69c25d981742fc6be3ed3107843381ed0ee72
4
- data.tar.gz: 709b239f59384ab61adf1f258aea4f6f429846a7d1bebce1373694c6a3b8bd1d
3
+ metadata.gz: 6f8ba18240c4cbc9a772505388ca2cc1c86a5afbe6b68e28c2244d622cc2d827
4
+ data.tar.gz: a6c6864e7b9753cfb0e92c72940effc3b6b9d14845616941e63ea909c2ffe042
5
5
  SHA512:
6
- metadata.gz: 0e992ff3b009ae88f5bf03fd50694b241eb8dfdb316c8c71d036d8e55d582018a32d9c7c306d1c2dc85cf9d12413785b44dc796a11ea9f0bec8b879416014375
7
- data.tar.gz: b3ba21ef6d73d9d077f172535451b6ba62a7410f610271601c485e356e4df22ef5fb5c741d113b7ed43773a798a036cacc29564fcfd231807f02a9520bcf5cc2
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`.
@@ -58,8 +58,11 @@ module FulfilApi
58
58
 
59
59
  # @return [Faraday::Connection]
60
60
  def connection
61
- # TODO: Allow passing configuration options for the request
62
- @connection ||= Faraday.new(headers: request_headers, url: api_endpoint) do |connection|
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 = "v2" if api_version.nil?
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FulfilApi
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
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.3
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-10-28 00:00:00.000000000 Z
11
+ date: 2024-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport