Skip to content

Commit

Permalink
Rewrite the gem to use the Amazon Selling Partner API
Browse files Browse the repository at this point in the history
While functional, this is a work in progress and  not ready for
production use yet.
  • Loading branch information
hakanensari committed Sep 12, 2024
1 parent 2174661 commit dd0e09e
Show file tree
Hide file tree
Showing 213 changed files with 8,004 additions and 53,588 deletions.
47 changes: 4 additions & 43 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
## Contributing

In the spirit of [free software][free-sw], everyone is encouraged to help
improve this project. Here are some ways you can contribute:

[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html

* Report bugs.
* Suggest new features.
* Write or edit documentation.
* Write code (**no patch is too small**: fix typos, add comments, clean up
inconsistent whitespace).
* [Fix issues.][issues]

[issues]: https://github.com/hakanensari/peddler/issues

## Submitting an Issue

We use the [GitHub issue tracker][issues] to track bugs and features. Before
submitting a bug report or feature request, check to make sure it hasn't
already been submitted. When submitting a bug report, please include a [Gist][]
that includes a stack trace and any details that may be necessary to reproduce
the bug.

Do not submit issues that are not specific to Peddler. Instead, find help on the
[Amazon seller forum][forum].

[gist]: https://gist.github.com/
[forum]: https://sellercentral.amazon.com/forums/c/amazon-marketplace-web-service-mws/

## Submitting a Pull Request

1. [Fork the repository.][fork]
2. [Create a topic branch.][branch]
3. Add tests for your unimplemented feature or bug fix.
4. Run `bundle exec rake`. If your tests pass, return to step 3.
5. Implement your feature or bug fix.
6. Run `bundle exec rake`. If your tests fail, return to step 5.
7. Run `open coverage/index.html`. If your changes are not completely covered
by your tests, return to step 3.
8. Commit and push your changes.
9. [Submit a pull request.][pr]
Only submit issues that are specific to Peddler. Otherwise, reach out to Amazon [Developer Support][] or find help on
their [GitHub Discussions][].

[fork]: http://help.github.com/fork-a-repo/
[branch]: http://learn.github.com/p/branching.html
[pr]: http://help.github.com/send-pull-requests/
[Developer Support]: https://developer.amazonservices.com/support
[GitHub Discussions]: https://github.com/amzn/selling-partner-api-models/discussions
17 changes: 0 additions & 17 deletions .github/stale.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
image: ruby:3.1
steps:
- uses: actions/checkout@v3
- run: ./scripts/documentation_crawler.rb
- run: ./bin/crawl-documentation.rb

coverage:
if: github.event_name == 'push'
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.bundle
Gemfile.lock
.yardoc
bin
coverage
doc
gemfiles/*.gemfile.lock
pkg
mws.yml
selling-partner-api-models
test/config.json
7 changes: 4 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
inherit_from: ".rubocop_todo.yml"

require:
- rubocop-minitest
- rubocop-performance
- rubocop-rake
inherit_gem:
rubocop-shopify: rubocop.yml
inherit_from: ".rubocop_todo.yml"

AllCops:
Exclude:
- "gemfiles/**/*"
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.2
33 changes: 3 additions & 30 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
Layout/LineLength:
Exclude:
- "test/**/*"
AllowedPatterns: ['\A\s*#']
Lint/EmptyBlock:
Exclude:
- "Appraisals"
Lint/StructNewOverride:
Exclude:
- "test/**/*"
Metrics/AbcSize:
Exclude:
- "test/**/*"
Metrics/ClassLength:
Exclude:
- "lib/mws/**/client.rb"
- "test/**/*"
Metrics/MethodLength:
Exclude:
- "lib/mws/**/client.rb"
- "test/**/*"
Metrics/ParameterLists:
Exclude:
- "lib/mws/**/client.rb"
AllowedPatterns:
- ^\s*\w+ = ".*"$
Naming/AccessorMethodName:
Exclude:
- "lib/mws/**/client.rb"
Naming/VariableNumber:
Exclude:
- "test/**/*"
Style/OpenStructUse:
Exclude:
- "test/**/*"
- "lib/peddler/api/*.rb"
15 changes: 0 additions & 15 deletions Appraisals

This file was deleted.

5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM ruby:2.7
FROM ruby:3.5

ENV LC_ALL C.UTF-8

RUN mkdir gem
WORKDIR /gem
ADD . /gem
RUN bundle install
RUN bundle exec appraisal install
CMD bundle exec appraisal rake
CMD bundle exec rake
28 changes: 12 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

gemspec

gem 'rake'
gem 'rubocop'
gem 'rubocop-minitest'
gem 'rubocop-performance'
gem 'rubocop-rake'
gem 'yard'

group :test do
gem 'appraisal'
gem 'minitest'
gem 'minitest-focus'
gem 'simplecov'
gem 'vcr'
end
gem "minitest"
gem "rake"
gem "rubocop", require: false
gem "rubocop-minitest", require: false
gem "rubocop-performance", require: false
gem "rubocop-rake", require: false
gem "rubocop-shopify", require: false
gem "simplecov"
gem "vcr"
gem "webmock"
gem "yard"
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/maintainability)](https://codeclimate.com/github/hakanensari/peddler/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/test_coverage)](https://codeclimate.com/github/hakanensari/peddler/test_coverage)

> :boom: Amazon is migrating to the newly-launched Selling Partner API (SP-API) and is no longer granting new users access to the MWS APIs. I hope to add support in Peddler in due course.
> :boom: I'm currently working on the [Selling Partner API (SP-API)](https://developer.amazonservices.com/sp-api-docs/overview). The README below describes the latest release for the obsolete MWS API.
**Peddler** is a Ruby interface to the [Amazon MWS API](https://developer.amazonservices.com/), a collection of web services that help Amazon sellers programmatically exchange data on their listings, orders, payments, reports, and more.

Expand All @@ -24,7 +24,6 @@ require "peddler"

A client requires the AWS credentials of the application developer. If you are working in a single MWS region, you can set them globally.


```bash
export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY
Expand Down
14 changes: 7 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rubocop/rake_task'
require 'yard'
require "bundler/gem_tasks"
require "rake/testtask"
require "rubocop/rake_task"
require "yard"

Rake::TestTask.new do |t|
t.libs << 'test'
t.pattern = 'test/**/test_*.rb'
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end
RuboCop::RakeTask.new
YARD::Rake::YardocTask.new

task default: %i[test rubocop]
task default: [:rubocop, :test]
4 changes: 4 additions & 0 deletions bin/clone-api-models
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

rm -rf selling-partner-api-models
git clone [email protected]:amzn/selling-partner-api-models.git
16 changes: 8 additions & 8 deletions scripts/documentation_crawler.rb → bin/crawl-documentation
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'open3'
require 'net/http'
require 'logger'
require "open3"
require "net/http"
require "logger"

logger = Logger.new($stdout)

search_command = 'grep -R @see ./lib'
search_command = "grep -R @see ./lib"
output, = Open3.capture3(search_command)
matches = output.split("\n")

Expand All @@ -19,18 +19,18 @@
response = Net::HTTP.get_response(URI(url))
case response
when Net::HTTPSuccess
logger.info "✅ #{response.code} #{url}"
logger.info("✅ #{response.code} #{url}")
when Net::HTTPFound
logger.warn "👀 #{response.code} #{url}"
logger.warn("👀 #{response.code} #{url}")
else
failed = true
logger.error "❌ #{response.code} #{url}"
logger.error("❌ #{response.code} #{url}")
end
end
end
threads.each(&:join)

if failed
logger.warn 'Please fix broken documentation links.'
logger.warn("Please fix broken documentation links.")
exit 1
end
Loading

0 comments on commit dd0e09e

Please sign in to comment.