zaikio-procurement 2.1.2 → 2.1.4

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: 04f6172910b9cfece842db08006b3e020d4de614c940585f74db84c24280e7d1
4
- data.tar.gz: 42e2c9fc11f422ca0b0c57dbb1c5dacde30cacf969ac352dbb472c7818cbb67f
3
+ metadata.gz: 5a01d86fae261776a22d5a45836ee072ba969c6e518dd5b51626786f5632a16a
4
+ data.tar.gz: bd1238197f0919b76502d99ca67cedcae8d7958fdf1f9cd4ab354311684857ee
5
5
  SHA512:
6
- metadata.gz: '04521909e30e7a25ebc1082a0694047a671559b764b75c22844f34c74f9a1264aa59d6afa11be80f8f2459deb2231cec2877dc13b2f61bfa26ed59d198abd4ff'
7
- data.tar.gz: fd6a863c8938b79b50aee6c5f395f3a0e60f4cb9de6cf39fe6435510f54af6cb645e01ffb13b5a20d853d3b09c9d0b5bafec7d292cc91e1834434cd0e85982c3
6
+ metadata.gz: 4e85b8fc11d8fe0754929521c6bb4e72333023b6ea9c29686d29b0214383e0cd7b2807afc3d2aeaacf1c4e261caa2976dbb7ddf0c9333ea3552e8d0bb13f931e
7
+ data.tar.gz: 9f3b49e4912f9f82019fa75c40a04008523b1222528a33c1dcb7083e01262ce1d8104325b0615cc91ee0914837544ededb863ade618951aa5364d0a03a0baaec
data/README.md CHANGED
@@ -34,7 +34,7 @@ end
34
34
 
35
35
  The Procurement Client has an ORM like design.
36
36
 
37
- For the requests to work, a valid JSON Web token with the correct OAuth Scopes must always be provided. Please refer to [zakio-oauth_client](https://github.com/zaikio/zaikio-oauth_client).
37
+ For the requests to work, a valid JSON Web token with the correct OAuth Scopes must always be provided. Please refer to [zaikio-oauth_client](https://github.com/zaikio/zaikio-oauth_client).
38
38
 
39
39
  If you want to know which actions are available and which scopes are required, please refer to the [Procurement Consumer API V2 Reference](https://docs.zaikio.com/api/procurement_consumers/consumers_v2.html).
40
40
 
@@ -3,13 +3,6 @@ module Zaikio
3
3
  class Variant < Base
4
4
  include_root_in_json :variant
5
5
 
6
- # Constants
7
- def self.types
8
- %w[carbonless_copy_paper coating coating_plate envelope ink laminating_foil
9
- offset_printing_blanket plate ring_binding self_adhesive sheet_substrate
10
- sleeking_foil specialized_printing_blanket web_substrate].freeze
11
- end
12
-
13
6
  # Attributes
14
7
  attributes :type, :summary, :global_trade_item_number, :brightness, :category, :color,
15
8
  :dimensions_unit, :form, :grain, :height, :optical_brightness_agent,
@@ -5,38 +5,21 @@ module Zaikio
5
5
  @type = type.split.join
6
6
  @query = query
7
7
  @filters = filters
8
- @valid_types = Zaikio::Procurement::Variant.types + ["all"]
9
8
 
10
9
  unless @filters.respond_to?(:stringify_keys)
11
10
  raise ArgumentError, "When using additional search parameters, you must pass a hash as an argument."
12
11
  end
13
12
 
14
- unless @type.split(",").all? { |t| @valid_types.include?(t) }
15
- raise ArgumentError,
16
- "When using the type parameter, you must pass one or more of \
17
- the following types: #{@valid_types.join(', ')}."
18
- end
19
-
20
- @response = Zaikio::Procurement::Base.with(path).get
13
+ @response = Zaikio::Procurement::Base
14
+ .request(:get, "variants", type: @type, query: @query, filters: @filters)&.body&.dig("data")
21
15
  end
22
16
 
23
17
  def results
24
- @response.results.collect { |variant| Zaikio::Procurement::Variant.new(variant) }
18
+ @response["results"].collect { |variant| Zaikio::Procurement::Variant.new(variant) }
25
19
  end
26
20
 
27
21
  def available_filters
28
- @response.available_filters
29
- end
30
-
31
- private
32
-
33
- def path
34
- "variants".tap do |qp|
35
- qp << "?type=#{@type}"
36
- qp << "&query=#{@query}" if @query
37
- qp << "&" if @query && @filters.any?
38
- qp << @filters.to_query("filters") if @filters
39
- end
22
+ @response["available_filters"]
40
23
  end
41
24
  end
42
25
  end
@@ -1,5 +1,5 @@
1
1
  module Zaikio
2
2
  module Procurement
3
- VERSION = "2.1.2".freeze
3
+ VERSION = "2.1.4".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaikio-procurement
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaikio GmbH
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-11-08 00:00:00.000000000 Z
12
+ date: 2023-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby