synsbasen_api 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d13815e17928657fa26ebc1d124b909410034c2713e61f48ddb730ca255e137
4
- data.tar.gz: 58476734c861a468c7ad7aab2a87cf5815c5420c70176babec6614b88666fe28
3
+ metadata.gz: 488fa94b15f086f18590d5e13bda9455648fbdc8794b639760bf5b39708b74f5
4
+ data.tar.gz: b6f821fc79f849a6a97927e65f39a68896b08307579b0bf62b09c3f606b22b29
5
5
  SHA512:
6
- metadata.gz: a5e5d967bcc260fa27c79c1887ae250d22c88dcd1a8578266fb4340060e3225cb74a3879c93e50ad2cbc8ce9fd25d2aae06c5068bf28ea5216a9bd68cb671ee6
7
- data.tar.gz: 278e5e5cdf251caf9b64fdb134cc0d961b620cb11f7b5b393704ad32e04ddac63404bd3ab88ad458a032ba7667f3e138890ce729bb2912d77fbbe9de784ea391
6
+ metadata.gz: b4ab45d11acbfecd31e8f925952697f84f5a41bee63f941a5eb7d14600ce6e6c88b38f7b0c5d0d663bcba393f4ac89b1463f1f2ed1396663e767dfddb5712389
7
+ data.tar.gz: eea99086d568db341f04f43e1e54048126a658c4dbd753e83b127b232f83121c8721a690bd503a86e0b206bc4d5ea7a9fd44c20f08341978d4b7704983579d3e
@@ -12,6 +12,9 @@ module SynsbasenApi
12
12
  # @return [Boolean] Indicates whether there is more data available in the response.
13
13
  attr_reader :has_more
14
14
 
15
+ # @return [Numeric] The total number of pages available.
16
+ attr_reader :total_pages
17
+
15
18
  # Initializes a new instance of `ApiResponse` with the provided response data.
16
19
  #
17
20
  # @param response [Hash] The response data from the API.
@@ -21,7 +24,10 @@ module SynsbasenApi
21
24
  def initialize(response)
22
25
  @data = response[:data]
23
26
  @cost = response[:cost]
24
- @has_more = response[:has_more] || false
27
+
28
+ %i[has_more total_pages].each do |key|
29
+ instance_variable_set("@#{key}", response[key]) if response.key?(key)
30
+ end
25
31
  end
26
32
  end
27
33
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cgi/escape'
4
+
3
5
  module SynsbasenApi
4
6
  # The `Vehicle` class provides methods for interacting with vehicle-related
5
7
  # endpoints in the Synsbasen API. It extends the `Client` class.
@@ -20,7 +22,8 @@ module SynsbasenApi
20
22
  # @return [ApiResponse] An instance of `ApiResponse` containing details
21
23
  # of the specified vehicle.
22
24
  def find_by_registration(registration, expand: [])
23
- get("/v1/vehicles/registration/#{registration}", expand: expand)
25
+ escaped_registration = CGI.escape(registration)
26
+ get("/v1/vehicles/registration/#{escaped_registration}", expand: expand)
24
27
  end
25
28
 
26
29
  # Retrieves information about a vehicle based on its VIN (Vehicle Identification Number).
@@ -2,5 +2,5 @@
2
2
 
3
3
  module SynsbasenApi
4
4
  # The `VERSION` module specifies the version of the SynsbasenApi gem.
5
- VERSION = "1.0.3"
5
+ VERSION = "1.0.5"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synsbasen_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Poulsen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-11-14 00:00:00.000000000 Z
12
+ date: 2024-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport