plants 0.2.0 → 0.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
  SHA256:
3
- metadata.gz: f19367bf655abf1c1d915f59af1efe4422864a9b0501c436b00fe7e466d36294
4
- data.tar.gz: bbd93479682c27feb7531aa83361eba060efb63f7e317930e5b30cb7fa9a55b9
3
+ metadata.gz: 0aa2440db1c107756d88cca164f0dbdb0258dab428bb3c28ab282b09c0dfdbf7
4
+ data.tar.gz: ff4cd3faf204460a05376632b42e762518a7dbdd71d754f7d28f2207433385c1
5
5
  SHA512:
6
- metadata.gz: 56e75eca4db0d770db6399322ba73b9e551baae162f5d412b78a8fe0a3df218c295db02dcb51f5d4a05184cfa266b1f3115fce06368e64dafeba27fd83aabe8b
7
- data.tar.gz: 3f6370875a99aff8ca0a47d16e0fca8633f5b0ccb7ea5c4c0dfdb166607ebad9f0fac1875a305a5d0d8971734d697774f6ff0dfa49d2414d922df13f2c4b1927
6
+ metadata.gz: ba78c624f382d3d63ffba79e2d9774de426057dfcde4209d537915e2ba9a0a7ac1baee303b04fc9653a1e19ed7cff5e95f69874facde550c25bf740cca288dfb
7
+ data.tar.gz: 6b1a5de74246ace188e2c0156325f0aa4c19698c8e9e876083171a9b1bbec0322d54185dd239a6d4f4f82dd429164a49061ae251ab6413229931690165d0c6de
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2024-03-07
4
+ - allow user to override http timeout
5
+
3
6
  ## [0.2.0] - 2024-02-29
4
7
  - allow user to override logger
5
8
 
data/README.md CHANGED
@@ -19,6 +19,11 @@ Plants::Log.instance = logger # Your logger here
19
19
  ### Endpoints
20
20
  All methods return an instance of [`HTTP::Response`](https://github.com/httprb/http/wiki/Response-Handling)
21
21
 
22
+ The HTTP timeout is by default 10 seconds, you can override this by:
23
+ ```ruby
24
+ Plants.timeout = 5 # new value here
25
+ ```
26
+
22
27
  #### Corrections
23
28
  ```ruby
24
29
  # List
data/lib/plants/client.rb CHANGED
@@ -35,7 +35,7 @@ module Plants
35
35
  # @return [::HTTP::Client]
36
36
  def http
37
37
  HTTP
38
- .timeout(10)
38
+ .timeout(config.timeout)
39
39
  .use(logging: { logger: Log.instance })
40
40
  .headers({ 'User-Agent' => "Plants #{Plants::VERSION} ruby-#{RUBY_VERSION}" })
41
41
  end
data/lib/plants/config.rb CHANGED
@@ -3,11 +3,14 @@ module Plants
3
3
  #
4
4
  # @!attribute token
5
5
  # @return [String]
6
+ # @!attribute timeout
7
+ # @return [Integer]
6
8
  #
7
9
  class Config
8
10
  def initialize
9
11
  @token = nil
12
+ @timeout = 10
10
13
  end
11
- attr_accessor :token
14
+ attr_accessor :token, :timeout
12
15
  end
13
16
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Plants
4
4
  # @return [String]
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
data/lib/plants.rb CHANGED
@@ -17,6 +17,12 @@ module Plants
17
17
  client.config.token = new_value
18
18
  end
19
19
 
20
+ # @param new_value [Integer]
21
+ # @return [void]
22
+ def timeout=(new_value)
23
+ client.config.timeout = new_value
24
+ end
25
+
20
26
  # @return [Plants::Config]
21
27
  def config
22
28
  client.config
data/plants.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Xero"]
9
9
  spec.email = ["vhector.1337@gmail.com"]
10
10
 
11
- spec.summary = "Plants API gem."
11
+ spec.summary = "Trefle API gem."
12
12
  spec.description = "Gem to interact with Trefle API."
13
13
  spec.homepage = "https://github.com/one-m1nd/plants"
14
14
  spec.required_ruby_version = ">= 3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plants
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2024-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -81,5 +81,5 @@ requirements: []
81
81
  rubygems_version: 3.4.10
82
82
  signing_key:
83
83
  specification_version: 4
84
- summary: Plants API gem.
84
+ summary: Trefle API gem.
85
85
  test_files: []