muffin_man 0.1.3 → 0.2.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: 25135df0da6abb1e29b819b2f82be37186c580c26c5ed99532c0f70450dfd078
4
- data.tar.gz: c90972f67f07f7c8987027c3e143dd8574c8fd3dd13bedc01b30a20518f13ddd
3
+ metadata.gz: d1b217205a970848a9dc08eea1daf04d52da4d5970bff2a00f0041867c320837
4
+ data.tar.gz: d7df1a7bd5738e336380d3ce6c17df85610d36498997374b2f5e34061a17cf69
5
5
  SHA512:
6
- metadata.gz: 189e7f5656b429d6493a780f9b847b2a41e65f61d69aa21420e797b1d75b94d00db432569d5c89f0e8b5d976d76191cf410c071ce904762fb32a6ca0c7f5217e
7
- data.tar.gz: 0bed33effc0565b1959cce60840261aa95f7388ffec1bb6d784ea1742ee1022f813dfe455a2370c88d15b609cbc7d1ff0d99bc5120b71862ba3c9ebadd97bd7f
6
+ metadata.gz: 75d9be6ff3849a9a45ef506e90c4a13d407aeef6ea8f7e84cf1f3c30d4384e451e70ca704f1d7ffb5f621b5bfa0fed4c058a7dabdffdae35c2019c7a545b2914
7
+ data.tar.gz: 7d7696a4e3e9400471e0444b5864592dd0f5297ad1733b51a51bfbe5253564059d5397489acb0f53d7529611bd778cab1d6206eeab4606d39b8f0bc779703434
@@ -0,0 +1,32 @@
1
+ name: Ruby CI
2
+
3
+ # Controls when the workflow will run
4
+ on:
5
+ # Triggers the workflow on push or pull request events but only for the master branch
6
+ push:
7
+ branches:
8
+ - 'master'
9
+ pull_request:
10
+ branches:
11
+ - 'master'
12
+
13
+ jobs:
14
+ ci-build:
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ matrix:
19
+ ruby-version: [2.7, 2.6, 2.5]
20
+
21
+ # Check-out repo
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v2
25
+ - name: Set up Ruby ${{ matrix.ruby-version }}
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby-version }}
29
+ - name: Install dependencies
30
+ run: bundle install
31
+ - name: Run RSpec
32
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -9,5 +9,8 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
12
13
  .env
13
14
  Gemfile.lock
15
+ *.gem
16
+ .ruby-version
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.4
2
+ TargetRubyVersion: 2.5
3
3
 
4
4
  Style/StringLiterals:
5
5
  Enabled: true
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Gavin
3
+ Copyright (c) 2022 Pattern Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,56 @@
1
+ module MuffinMan
2
+ module V20201201
3
+ class CatalogItems < SpApiClient
4
+ SANDBOX_KEYWORDS = "shoes".freeze
5
+ SANDBOX_ASIN = "B07N4M94X4".freeze
6
+ SANDBOX_MARKETPLACE_IDS = "ATVPDKIKX0DER".freeze
7
+ attr_reader :keywords, :asin, :marketplace_ids, :params
8
+
9
+ SEARCH_CATALOG_ITEMS_PARAMS = %w[
10
+ includedData
11
+ brandNames
12
+ classificationIds
13
+ pageSize
14
+ pageToken
15
+ keywordsLocale
16
+ locale
17
+ ].freeze
18
+ GET_CATALOG_ITEM_PARAMS = %w[includeData locale].freeze
19
+
20
+ def search_catalog_items(keywords, marketplace_ids, params = {})
21
+ if sandbox
22
+ keywords = SANDBOX_KEYWORDS
23
+ marketplace_ids = SANDBOX_MARKETPLACE_IDS
24
+ params = {}
25
+ end
26
+ @keywords = keywords.is_a?(Array) ? keywords : [keywords]
27
+ @marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
28
+ @params = params
29
+ @local_var_path = "/catalog/2020-12-01/items"
30
+ @query_params = {
31
+ "keywords" => @keywords.join(","),
32
+ "marketplaceIds" => @marketplace_ids.join(",")
33
+ }
34
+ @query_params.merge!(@params.slice(*SEARCH_CATALOG_ITEMS_PARAMS))
35
+ @request_type = "GET"
36
+ call_api
37
+ end
38
+
39
+ def get_catalog_item(asin, marketplace_ids, params = {})
40
+ if sandbox
41
+ asin = SANDBOX_ASIN
42
+ marketplace_ids = SANDBOX_MARKETPLACE_IDS
43
+ params = {}
44
+ end
45
+ @asin = asin
46
+ @marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
47
+ @params = params
48
+ @local_var_path = "/catalog/2020-12-01/items/#{@asin}"
49
+ @query_params = { "marketplaceIds" => @marketplace_ids.join(",") }
50
+ @query_params.merge!(@params.slice(*GET_CATALOG_ITEM_PARAMS))
51
+ @request_type = "GET"
52
+ call_api
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuffinMan
4
- VERSION = "0.1.3"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/muffin_man.rb CHANGED
@@ -2,6 +2,7 @@ require_relative "muffin_man/version"
2
2
  require "muffin_man/sp_api_client"
3
3
  require "muffin_man/solicitations"
4
4
  require "muffin_man/reports"
5
+ require "muffin_man/v20201201/catalog_items"
5
6
 
6
7
  module MuffinMan
7
8
  class Error < StandardError; end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muffin_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin
8
8
  - Jason
9
9
  - Nate
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-11-19 00:00:00.000000000 Z
13
+ date: 2022-01-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -102,7 +102,7 @@ dependencies:
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: 2.4.4
105
- description:
105
+ description:
106
106
  email:
107
107
  - gavin@pattern.com
108
108
  - jason@pattern.com
@@ -112,6 +112,7 @@ extensions: []
112
112
  extra_rdoc_files: []
113
113
  files:
114
114
  - ".circleci/config.yml"
115
+ - ".github/workflows/ci.yml"
115
116
  - ".gitignore"
116
117
  - ".rspec"
117
118
  - ".rubocop.yml"
@@ -126,13 +127,14 @@ files:
126
127
  - lib/muffin_man/reports.rb
127
128
  - lib/muffin_man/solicitations.rb
128
129
  - lib/muffin_man/sp_api_client.rb
130
+ - lib/muffin_man/v20201201/catalog_items.rb
129
131
  - lib/muffin_man/version.rb
130
132
  - muffin_man.gemspec
131
133
  homepage: https://github.com/patterninc/muffin_man
132
134
  licenses:
133
135
  - MIT
134
136
  metadata: {}
135
- post_install_message:
137
+ post_install_message:
136
138
  rdoc_options: []
137
139
  require_paths:
138
140
  - lib
@@ -147,8 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
149
  - !ruby/object:Gem::Version
148
150
  version: '0'
149
151
  requirements: []
150
- rubygems_version: 3.0.3
151
- signing_key:
152
+ rubygems_version: 3.1.6
153
+ signing_key:
152
154
  specification_version: 4
153
155
  summary: Amazon Selling Partner API client
154
156
  test_files: []