zaikio-procurement 2.1.3 → 2.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: 0c698d8e528f23facf092f4bf7ece77699ac57ca51d2987e26ce38e5f98b8a1e
4
- data.tar.gz: 453c48a1ea66df762187c7a66d915c6605c131bdcf35e5e3bb4554a52f1af763
3
+ metadata.gz: 5a01d86fae261776a22d5a45836ee072ba969c6e518dd5b51626786f5632a16a
4
+ data.tar.gz: bd1238197f0919b76502d99ca67cedcae8d7958fdf1f9cd4ab354311684857ee
5
5
  SHA512:
6
- metadata.gz: 9f9615de2a6c7b3af97a6551d25a203ef201de768879192795eb8979f17b5a649fc64403c5c607ffa128306db890fd2d318fd7581fd56c073b9ac427b4ef8000
7
- data.tar.gz: 357c4dee783b25d5b3aa2dcf0dbe401774d939c17e47a6305bed9a26d051b9a800875ce67228ec1d99f4be528ab96f3a19be0d1373080c98a1c600a0fe0d84aa
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,14 +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 paper_proofing
11
- paper_sheetfed paper_webfed].freeze
12
- end
13
-
14
6
  # Attributes
15
7
  attributes :type, :summary, :global_trade_item_number, :brightness, :category, :color,
16
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.3".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.3
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-12-02 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