carriage 1.2.1 → 1.3.0

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: e0a6df75b802ea7014df9978ab2d1aedb81a00328c2103ce83afc666822b7e15
4
- data.tar.gz: 92e0e907d018c4fdd852c1ada76f671bd5e9ac328aaaf6a2f4684293211eb289
3
+ metadata.gz: 8228bc36f8d0d5cff5944544d5fc80926ffd3962470232bb068df1f2f3656a66
4
+ data.tar.gz: 0bef66814a7980221cb90180df20995a313e36bab34086bb81a82c176d10dcbe
5
5
  SHA512:
6
- metadata.gz: ed3913d1b34914f84aa6c6e61765d43cfc927d84ea20a44c05a92d3da98423f4f768e12e9a65c72badf7a2b5c869e265b0d8530cf7f629511db4fa00d7506f81
7
- data.tar.gz: 559346f9ea611a91d80afdd30f0bb6d77e434ed567a889417179a4958edc6899c0337e731a495cc09aca51df94444ba0b08e8b9b43bba48c8b91bc67755931a0
6
+ metadata.gz: 78577f55b2f9da6f512be4138649a1b8519c3231014f13f1543949d7238acd18020cb5d73e0628fa94efdf244f41c6ca8e8107ed780de12ad7bf13c046fee333
7
+ data.tar.gz: d748fd18512e5b62cc86ed902f96f8a042550f89ec644cf739e42500d39288c2cce8d8e2de40e74d2f6aeb98e8aac00f98b5f02ab43e09b8e9f320c8425d5531
@@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.3.0]
8
+ ## Add
9
+ - Code-style now adheres to standard gem
10
+
11
+ ## Change
12
+ - AssociateTag is not required for Carriage.build anymore
13
+
7
14
  ## [1.2.1]
8
15
  - Rollback some changes in gemspec
9
16
 
@@ -49,4 +56,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
49
56
  - `AWSAccessKeyId` is not a required argument
50
57
 
51
58
  ## [0.1.0]
52
- First public version, only focused on supporting one region - US.
59
+ First public version, only focused on supporting one region - US.
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  <img src="./vendor/logo.jpg" alt="Carriage project logo" width="400">
8
8
  </p>
9
9
 
10
- Carriage is a Ruby micro-wrapper to [Amazon's Cart Form](https://webservices.amazon.com/paapi5/documentation/add-to-cart-form.html) functionality. Gem helps add any number of items to customer's shopping cart and direct him to Amazon website to complete order.
10
+ Carriage is a Ruby wrapper to [Amazon's Cart Form](https://webservices.amazon.com/paapi5/documentation/add-to-cart-form.html) functionality. Gem helps add any number of items to customer's shopping cart and direct him to Amazon website to complete order.
11
11
 
12
12
  To use this gem, you will eventually require Amazon's **AssociateTag**, so consider to [register first](https://webservices.amazon.com/paapi5/documentation/register-for-pa-api.html) with Amazon Associate program and become more familiar with it.
13
13
 
data/Rakefile CHANGED
@@ -7,4 +7,4 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.test_files = FileList["test/**/*_test.rb"]
8
8
  end
9
9
 
10
- task :default => :test
10
+ task default: :test
@@ -1,15 +1,15 @@
1
- require_relative 'lib/carriage/version'
1
+ require_relative "lib/carriage/version"
2
2
 
3
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"]
4
+ spec.name = "carriage"
5
+ spec.version = Carriage::VERSION
6
+ spec.authors = ["Stanislav (Stas) Katkov"]
7
+ spec.email = ["sk@skylup.com"]
8
8
 
9
- spec.summary = "Carriage is a Ruby micro-wrapper to Amazon's Cart Form functionality (part of Product Advertising API v5.0)"
10
- spec.description = "Gem helps add any number of items to customer's shopping cart and direct him to Amazon website to complete order."
11
- spec.homepage = "https://skatkov.github.io/carriage/"
12
- spec.license = "MIT"
9
+ spec.summary = "Carriage is a Ruby micro-wrapper to Amazon's Cart Form functionality (part of Product Advertising API v5.0)"
10
+ spec.description = "Gem helps add any number of items to customer's shopping cart and direct him to Amazon website to complete order."
11
+ spec.homepage = "https://skatkov.github.io/carriage/"
12
+ spec.license = "MIT"
13
13
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
@@ -18,15 +18,16 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
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
21
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
22
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
23
  end
24
24
 
25
- spec.bindir = "exe"
26
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_development_dependency 'rake'
30
- spec.add_development_dependency 'minitest'
31
- spec.add_development_dependency 'm'
29
+ spec.add_development_dependency "rake"
30
+ spec.add_development_dependency "minitest"
31
+ spec.add_development_dependency "m"
32
+ spec.add_development_dependency "standard"
32
33
  end
@@ -1,14 +1,14 @@
1
- require 'carriage/version'
2
- require 'carriage/locale'
3
- require 'carriage/url'
4
- require 'carriage/builder'
5
- require 'forwardable'
1
+ require "carriage/version"
2
+ require "carriage/locale"
3
+ require "carriage/url"
4
+ require "carriage/builder"
5
+ require "forwardable"
6
6
 
7
7
  module Carriage
8
8
  class << self
9
9
  extend Forwardable
10
10
 
11
- def_delegator 'Carriage::Url', :call
12
- def_delegator 'Carriage::Builder', :call, :build
11
+ def_delegator "Carriage::Url", :call
12
+ def_delegator "Carriage::Builder", :call, :build
13
13
  end
14
14
  end
@@ -1,7 +1,7 @@
1
1
  module Carriage
2
2
  class Builder
3
3
  class << self
4
- def call(items, tag:, key_id: nil, locale: :us)
4
+ def call(items, tag: nil, key_id: nil, locale: :us)
5
5
  params = {}
6
6
 
7
7
  wrap(items).each_with_index do |obj, index|
@@ -17,8 +17,8 @@ module Carriage
17
17
  params[:"Quantity.#{index + 1}"] = item.fetch(:QUANTITY, 1)
18
18
  end
19
19
 
20
- params[:AssociateTag] = tag
21
- params[:AWSAccessKeyId] = key_id unless (key_id.nil? || key_id.empty?)
20
+ params[:AssociateTag] = tag unless tag.nil? || tag.empty?
21
+ params[:AWSAccessKeyId] = key_id unless key_id.nil? || key_id.empty?
22
22
 
23
23
  Carriage.call(locale, params)
24
24
  end
@@ -36,4 +36,4 @@ module Carriage
36
36
  end
37
37
  end
38
38
  end
39
- end
39
+ end
@@ -5,21 +5,21 @@ module Carriage
5
5
  class NotFound < KeyError; end
6
6
 
7
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'
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
23
  }.freeze
24
24
 
25
25
  private_constant :HOSTS
@@ -27,9 +27,9 @@ module Carriage
27
27
  attr_reader :host
28
28
 
29
29
  def initialize(locale)
30
- @host = HOSTS.fetch(locale.to_sym.downcase) do |value|
30
+ @host = HOSTS.fetch(locale.to_sym.downcase) { |value|
31
31
  raise NotFound, "Locale not found: :#{value}"
32
- end
32
+ }
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'uri'
3
+ require "uri"
4
4
 
5
5
  module Carriage
6
6
  class Url
@@ -8,4 +8,4 @@ module Carriage
8
8
  "#{Locale.new(locale).host}?#{URI.encode_www_form params}"
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Carriage
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carriage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav (Stas) Katkov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-15 00:00:00.000000000 Z
11
+ date: 2020-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: standard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: Gem helps add any number of items to customer's shopping cart and direct
56
70
  him to Amazon website to complete order.
57
71
  email:
@@ -103,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
117
  - !ruby/object:Gem::Version
104
118
  version: '0'
105
119
  requirements: []
106
- rubygems_version: 3.0.6
120
+ rubygems_version: 3.1.2
107
121
  signing_key:
108
122
  specification_version: 4
109
123
  summary: Carriage is a Ruby micro-wrapper to Amazon's Cart Form functionality (part