carriage 1.0.0 → 1.1.1

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: 2af9360776787d7e2a4e9f4f2317d77b310559699a9b7d7b923eacf1b198d822
4
- data.tar.gz: dc7403b2856a523a108fc747a52a6951a321ddfe93e80212fb4de6ac830a38ae
3
+ metadata.gz: 181bfb93515134fe3a2dfe2a4a819ac766a429a50fe988ff5a37b657fb412d03
4
+ data.tar.gz: e3d30c1de73263876de519ba3ebbbc01c147cd8d71b4aa0c200d13ff86c89dcc
5
5
  SHA512:
6
- metadata.gz: caba7b6c2482adcc6a1c6c18cff1aa7cc5daefe206cab983931dac12718d48007c1fa6d7ad0e1bd36b207fc8740b01426f00ef8414e7304473e6d0f2f770b1b2
7
- data.tar.gz: 6a3461068f08071bb4a686212794952426978ffd28a620ef138ebcf779bae22075b6ec2be7f1abee2a586800691999a4da8158dd8d1fbc09a1f944b1dece5d53
6
+ metadata.gz: bdd2eddc8fc0e6ad0ac451aa395c858b371fe0961554e3d2e081499a76b01adac3051094e18ab665b7e3eecdc7986a317a6fb2d51f224fe129e1b62bc3245686
7
+ data.tar.gz: 1adb2d15d45d4ffa563653fb4e4b7127fff7da895005441406f4fa912bcb1173bc850910534389477a231ba12f9ab2c86f1907b17d31fe47a1d9d54395a8fb4a
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carriage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav (Stas) Katkov
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-12 00:00:00.000000000 Z
11
+ date: 2020-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: m
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -24,36 +52,20 @@ dependencies:
24
52
  - - ">="
25
53
  - !ruby/object:Gem::Version
26
54
  version: '0'
27
- description: This gem helps add any number of items to a customer's shopping cart
28
- and sending him to Amazon website to complete his order.
55
+ description: Gem helps add any number of items to customer's shopping cart and direct
56
+ him to Amazon website to complete order.
29
57
  email:
30
58
  - sk@skylup.com
31
59
  executables: []
32
60
  extensions: []
33
61
  extra_rdoc_files: []
34
- files:
35
- - ".gitignore"
36
- - ".travis.yml"
37
- - CHANGELOG.md
38
- - CODE_OF_CONDUCT.md
39
- - Gemfile
40
- - LICENSE.txt
41
- - README.md
42
- - Rakefile
43
- - bin/console
44
- - bin/setup
45
- - carriage.gemspec
46
- - lib/carriage.rb
47
- - lib/carriage/builder.rb
48
- - lib/carriage/locale.rb
49
- - lib/carriage/request.rb
50
- - lib/carriage/version.rb
51
- homepage: https://www.github.com/skatkov/carriage
62
+ files: []
63
+ homepage: https://skatkov.github.io/carriage/
52
64
  licenses:
53
65
  - MIT
54
66
  metadata:
55
- homepage_uri: https://www.github.com/skatkov/carriage
56
- source_code_uri: https://www.github.com/skatkov/carriage
67
+ homepage_uri: https://skatkov.github.io/carriage/
68
+ source_code_uri: https://github.com/skatkov/carriage
57
69
  changelog_uri: https://github.com/skatkov/carriage/blob/master/CHANGELOG.md
58
70
  post_install_message:
59
71
  rdoc_options: []
@@ -73,5 +85,6 @@ requirements: []
73
85
  rubygems_version: 3.1.2
74
86
  signing_key:
75
87
  specification_version: 4
76
- summary: Carriage is a Ruby wrapper to Amazon Product Advertising API 5.0 - Cart Form
88
+ summary: Carriage is a Ruby micro-wrapper to Amazon's Cart Form functionality (part
89
+ of Product Advertising API v5.0)
77
90
  test_files: []
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- .idea/
11
- .rakeTasks
12
- Gemfile.lock
@@ -1,19 +0,0 @@
1
- ---
2
-
3
- env:
4
- global:
5
- - CC_TEST_REPORTER_ID=60a3a7f0557745522235c43c9281570385a1c9d566a40946f91bb156e4ec4df0
6
- language: ruby
7
- cache: bundler
8
- rvm:
9
- - 2.7.0
10
- before_script:
11
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
12
- - chmod +x ./cc-test-reporter
13
- - ./cc-test-reporter before-build
14
- before_install: gem install bundler -v 2.1.2
15
- script:
16
- - "bundle install"
17
- - "bundle exec rake test"
18
- after_script:
19
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -1,28 +0,0 @@
1
- # Change Log
2
- All notable changes to this project will be documented in this file.
3
- This project adheres to [Semantic Versioning](http://semver.org/).
4
-
5
- ## [Unreleased]
6
-
7
- ##[1.0]
8
-
9
- - Finalize documentation
10
- - Release 1 version to show completeness of api
11
-
12
- ##[0.3.0]
13
-
14
- ### Added
15
- - Support for Amazon locales
16
- - Support for OfferListingId
17
-
18
- ## [0.2.0]
19
- ### Added
20
- - Set default quantity for a product
21
- - Write down locales and respective hosts associated with them
22
-
23
- ### Changed
24
- - Using `URI.encode_www_form` to build URL parameters
25
- - `AWSAccessKeyId` is not a required argument
26
-
27
- ## [0.1.0]
28
- First public version, only focused on supporting one region - US.
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at sk@skylup.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in carriage.gemspec
4
- gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "minitest", "~> 5.0"
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Stanislav (Stas) Katkov
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/README.md DELETED
@@ -1,66 +0,0 @@
1
- [![Gem Version](https://badge.fury.io/rb/carriage.svg)](https://badge.fury.io/rb/carriage)
2
- [![Maintainability](https://api.codeclimate.com/v1/badges/79ddcbeb02fe9447cd0d/maintainability)](https://codeclimate.com/github/skatkov/carriage/maintainability)
3
- [![Build Status](https://travis-ci.org/skatkov/carriage.svg?branch=master)](https://travis-ci.org/skatkov/carriage)
4
-
5
- # Carriage
6
- Carriage is a Ruby wrapper to [Amazon Product Advertising API 5.0 - Cart Form](https://webservices.amazon.com/paapi5/documentation/add-to-cart-form.html). This gem helps add any number of items to a customer's shopping cart and sending him to Amazon website to complete his order.
7
-
8
- To use this gem, you need to have Amazon **AssociateTag**, so don't forget to [register first](https://webservices.amazon.com/paapi5/documentation/register-for-pa-api.html) with Amazon Associate program.
9
-
10
- Programmatic access to product data is out of scope for this gem, but I recommend to use [vacuum gem](https://github.com/hakanensari/vacuum) if there is such a need.
11
-
12
- ## Installation
13
-
14
- Add this line to your application's Gemfile:
15
-
16
- ```ruby
17
- gem 'carriage'
18
- ```
19
-
20
- And then execute:
21
-
22
- $ bundle install
23
-
24
- Or install it yourself as:
25
-
26
- $ gem install carriage
27
-
28
- ## Usage
29
-
30
- A lot of examples could be found [in tests](https://github.com/skatkov/carriage/blob/master/test/carriage_test.rb)
31
-
32
- There are basically two ways to use this gem `bare metal` and with `builder`. Let's start off with baremetal:
33
-
34
- ### Bare metal
35
- ```
36
- Carriage.call(:us, {AssociateTag:'tag', "OfferListingId.1": "B00WR23X5I", "Quantity.1": 1})
37
- ```
38
- The only thing it will validate, is a presence of locale. All other parameters will be converted without any verification. So be carefull
39
-
40
- ### Builder
41
- Library also offers a slightly simpler interface that tries to valide data.
42
-
43
- ```
44
- items = [
45
- {OfferListingId: '123123'}.
46
- {ASIN: '1231234', quantity: 2}
47
- ]
48
-
49
- Carriage.build(items, tag: 'my_attribution_tag', locale: :uk)
50
- ```
51
- * Every item should be a hash, with `ASIN` or `OfferListingId` keys provided. By default quantity is 1.
52
- * Carriage.build also requires `:tag` attribute and defaults to `locale: :us` if nothing else was provided.
53
-
54
- ## Getting help
55
-
56
- * Ask specific questions about the API on the [Amazon forum](https://forums.aws.amazon.com/forum.jspa?forumID=9).
57
- * Report bugs and discuss potential features in [GitHub issues](https://github.com/skatkov/carriage/issues).
58
-
59
-
60
- ## License
61
-
62
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
63
-
64
- ## Code of Conduct
65
-
66
- Everyone interacting in the Carriage project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/skatkov/carriage/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task :default => :test
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "carriage"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,29 +0,0 @@
1
- require_relative 'lib/carriage/version'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "carriage"
5
- spec.version = Carriage::VERSION
6
- spec.authors = ["Stanislav (Stas) Katkov"]
7
- spec.email = ["sk@skylup.com"]
8
-
9
- spec.summary = "Carriage is a Ruby wrapper to Amazon Product Advertising API 5.0 - Cart Form"
10
- spec.description = "This gem helps add any number of items to a customer's shopping cart and sending him to Amazon website to complete his order."
11
- spec.homepage = "https://www.github.com/skatkov/carriage"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
-
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://www.github.com/skatkov/carriage"
17
- spec.metadata["changelog_uri"] = "https://github.com/skatkov/carriage/blob/master/CHANGELOG.md"
18
-
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
- end
24
- spec.bindir = "exe"
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
27
-
28
- spec.add_development_dependency 'm'
29
- end
@@ -1,14 +0,0 @@
1
- require 'carriage/version'
2
- require 'carriage/locale'
3
- require 'carriage/request'
4
- require 'carriage/builder'
5
- require 'forwardable'
6
-
7
- module Carriage
8
- class << self
9
- extend Forwardable
10
-
11
- def_delegator 'Carriage::Request', :call
12
- def_delegator 'Carriage::Builder', :call, :build
13
- end
14
- end
@@ -1,30 +0,0 @@
1
- module Carriage
2
- class Builder
3
- class << self
4
- def call(items, tag:, key_id: nil, locale: :us)
5
- return nil if items.nil? || items.empty?
6
-
7
- params = {}
8
- index = 0
9
-
10
-
11
- while index < items.size
12
- item = items[index].transform_keys(&:upcase)
13
-
14
- if item[:ASIN]
15
- params[:"ASIN.#{index + 1}"] = item[:ASIN]
16
- else
17
- params[:"OfferListingId.#{index + 1}"] = item[:OFFERLISTINGID]
18
- end
19
- params[:"Quantity.#{index + 1}"] = item.fetch(:QUANTITY, 1)
20
- index += 1
21
- end
22
-
23
- params[:AssociateTag] = tag
24
- params[:AWSAccessKeyId] = key_id unless (key_id.nil? || key_id.empty?)
25
-
26
- Carriage.call(locale, params)
27
- end
28
- end
29
- end
30
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Carriage
4
- class Locale
5
- class NotFound < KeyError; end
6
-
7
- HOSTS = {
8
- au: 'https://www.amazon.com.au/gp/aws/cart/add.html',
9
- br: 'https://www.amazon.com.br/gp/aws/cart/add.html',
10
- ca: 'https://www.amazon.ca/gp/aws/cart/add.html',
11
- fr: 'https://www.amazon.fr/gp/aws/cart/add.html',
12
- de: 'https://www.amazon.de/gp/aws/cart/add.html',
13
- in: 'https://www.amazon.in/gp/aws/cart/add.html',
14
- it: 'https://www.amazon.it/gp/aws/cart/add.html',
15
- jp: 'https://www.amazon.co.jp/gp/aws/cart/add.html',
16
- mx: 'https://www.amazon.com.mx/gp/aws/cart/add.html',
17
- sg: 'https://www.amazon.sg/gp/aws/cart/add.html',
18
- es: 'https://www.amazon.es/gp/aws/cart/add.html',
19
- tr: 'https://www.amazon.com.tr/gp/aws/cart/add.html',
20
- ae: 'https://www.amazon.ae/gp/aws/cart/add.html',
21
- uk: 'https://www.amazon.co.uk/gp/aws/cart/add.html',
22
- us: 'https://www.amazon.com/gp/aws/cart/add.html'
23
- }.freeze
24
-
25
- private_constant :HOSTS
26
-
27
- attr_reader :host
28
-
29
- def initialize(locale)
30
- @host = HOSTS.fetch(locale.to_sym.downcase)
31
- rescue KeyError
32
- raise NotFound, "Locale not found: :#{locale}"
33
- end
34
- end
35
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'uri'
4
-
5
- module Carriage
6
- class Request
7
- def self.call(locale, params)
8
- "#{Locale.new(locale).host}?#{URI.encode_www_form params}"
9
- end
10
- end
11
- end
@@ -1,3 +0,0 @@
1
- module Carriage
2
- VERSION = "1.0.0"
3
- end