muffin_man 1.5.12 → 2.0.1

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: 526c64f895aaaaa85524610880e5c0b7234891f2bc96ab96bd06fba80543abf4
4
- data.tar.gz: 3867cb62c7cf5c5fea6d28e271a3859591055d5e40debb13c21bcbd65749e8f7
3
+ metadata.gz: 44cf68d9d4bc52d95ee00e5f882246bb794fe7bbd13cef5aeccf67dfe4e31f63
4
+ data.tar.gz: 5435ab4676da530bc4774518ae74e54bbede3c420b67a1a5046664797850757a
5
5
  SHA512:
6
- metadata.gz: 617efb9dec4d967e99b9b0cd7d3ecc7423b4b38d4904a51db80dd4f947c6b66fc935fcb7bd9b7964b74d0535012186b948a4863f4780c663f0099c2fcf6e8216
7
- data.tar.gz: 0fe69dabf49c80198a53bd6b5a1d375bd0a17199cec2875f40d2597e79741f47e6ea411d9482d6d755226a5faf75554dd5dc59d3eb7253e98af3b8e572854453
6
+ metadata.gz: 51e8b193285bfef3da628db4556d997bd1c57683ae5e8542544852d703fefe5913902b4385d307d5ec95c9f987d237dc10b6253b2b8e26c6ee5eadaae9019658
7
+ data.tar.gz: 98afc241a276ede4d3d239da6b1229c0c4e83863b4911f95fccee93b28972c6ce5b49966cf0e2759a74f02c627c1547bf4841c6aab509604b656a1d62c5cf14a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 2.0.1 [#46](https://github.com/patterninc/muffin_man/pull/46)
2
+
3
+ - Support for passing an array of identifiers to search_catalog_items
4
+
5
+ # 2.0.0 [#47](https://github.com/patterninc/muffin_man/pull/47)
6
+
7
+ - BREAKING CHANGES: Changed signature of processing_directive check as it was confusing and was not working. processing_directive is a nested structure. It has marketplace_ids. Having marketplace_ids as an independent parameter was confusing.
8
+ - Added new endpoint support - delete_subscription.
9
+
1
10
  # 1.5.12 [#45](https://github.com/patterninc/muffin_man/pull/45)
2
11
 
3
12
  - Small update to putTransportDetails
@@ -17,9 +17,11 @@ module MuffinMan
17
17
  locale
18
18
  ].freeze
19
19
  GET_CATALOG_ITEM_PARAMS = %w[includedData locale].freeze
20
+ DEFAULT_IDENTIFERS_TYPE = "ASIN".freeze
20
21
 
21
22
  API_VERSION = "2020-12-01".freeze
22
23
 
24
+ # rubocop:disable Metrics/CyclomaticComplexity
23
25
  def search_catalog_items(keywords, marketplace_ids, params = {}, api_version=API_VERSION)
24
26
  if sandbox
25
27
  keywords = SANDBOX_KEYWORDS
@@ -27,6 +29,7 @@ module MuffinMan
27
29
  params = {}
28
30
  end
29
31
  @keywords = keywords.is_a?(Array) ? keywords : [keywords]
32
+ @identifiers = params["identifiers"].is_a?(Array) ? params["identifiers"] : [params["identifiers"]]
30
33
  @marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
31
34
  @params = params
32
35
  @local_var_path = "/catalog/#{api_version}/items"
@@ -34,10 +37,15 @@ module MuffinMan
34
37
  "marketplaceIds" => @marketplace_ids.join(",")
35
38
  }
36
39
  @query_params["keywords"] = @keywords.join(",") if @keywords.any?
40
+ if @identifiers.any?
41
+ @query_params["identifiers"] = @identifiers.join(",")
42
+ @query_params["identifiersType"] = params["identifiersType"] || DEFAULT_IDENTIFERS_TYPE
43
+ end
37
44
  @query_params.merge!(@params.slice(*search_catalog_items_params))
38
45
  @request_type = "GET"
39
46
  call_api
40
47
  end
48
+ # rubocop:enable Metrics/CyclomaticComplexity
41
49
 
42
50
  def get_catalog_item(asin, marketplace_ids, params = {}, api_version=API_VERSION)
43
51
  if sandbox
@@ -4,7 +4,6 @@ module MuffinMan
4
4
  module CatalogItems
5
5
  class V20220401 < BaseApi
6
6
  SEARCH_CATALOG_ITEMS_PARAMS = %w(
7
- identifiers
8
7
  identifiersType
9
8
  sellerId
10
9
  ).freeze
@@ -43,17 +43,12 @@ module MuffinMan
43
43
  params = params.transform_keys(&:to_s)
44
44
  subscription_params = { "destinationId" => params["destination_id"] }
45
45
  # currently SP-API's `processingDirective` only supports ANY_OFFER_CHANGED notification type.
46
- if PROCESSING_DIRECTIVE_SUPPORTED_NOTIFICATIONS.include? notification_type
47
- subscription_params["processingDirective"] =
48
- { "eventFilter" => { "eventFilterType" => notification_type,
49
- "marketplaceIds" => params["marketplace_ids"] } }
50
- unless params["aggregation_time_period"].nil?
51
- subscription_params["processingDirective"]["eventFilter"]
52
- .merge!("aggregationSettings" => {
53
- "aggregationTimePeriod" => params["aggregation_time_period"]
54
- })
55
- end
46
+ if include_processing_directive?(notification_type, params)
47
+ subscription_params.merge!(
48
+ "processingDirective" => params["processing_directive"]
49
+ )
56
50
  end
51
+
57
52
  subscription_params.merge!("payloadVersion" => params["payload_version"]) unless params["payload_version"].nil?
58
53
  @request_body = subscription_params
59
54
  @request_type = "POST"
@@ -80,6 +75,20 @@ module MuffinMan
80
75
  @request_type = "DELETE"
81
76
  call_api
82
77
  end
78
+
79
+ def delete_destination(destination_id)
80
+ @local_var_path = "#{NOTIFICATION_PATH}/destinations/#{destination_id}"
81
+ @scope = NOTIFICATION_SCOPE
82
+ @request_type = "DELETE"
83
+ call_api
84
+ end
85
+
86
+ private
87
+
88
+ def include_processing_directive?(notification_type, params)
89
+ PROCESSING_DIRECTIVE_SUPPORTED_NOTIFICATIONS.include?(notification_type) &&
90
+ params["processing_directive"].present?
91
+ end
83
92
  end
84
93
  end
85
94
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuffinMan
4
- VERSION = "1.5.12"
4
+ VERSION = "2.0.1"
5
5
  end
data/muffin_man.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "rspec", "~> 3.2"
22
22
  spec.add_development_dependency 'webmock', '~> 2.1'
23
- spec.add_development_dependency 'byebug'
23
+ spec.add_development_dependency 'byebug', '~> 11.1.3'
24
24
  spec.add_development_dependency 'mock_redis', '>=0.14'
25
25
  spec.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
26
26
  spec.add_runtime_dependency 'aws-sigv4', '>= 1.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muffin_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.12
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-01-03 00:00:00.000000000 Z
13
+ date: 2023-03-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -44,16 +44,16 @@ dependencies:
44
44
  name: byebug
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0'
49
+ version: 11.1.3
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ">="
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0'
56
+ version: 11.1.3
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: mock_redis
59
59
  requirement: !ruby/object:Gem::Requirement