marketplace 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0bf57e296438a82c814cf10e59f063a7a4026353
4
+ data.tar.gz: bcdc0e3074f2c4ea8c2a406fa8b3b66841fea80a
5
+ SHA512:
6
+ metadata.gz: 2768e890af621780d102927824917160d423d3e0bba77f74a09cad967ac7742e2f6d5c028d0faeb1ad64611d69931c3b6f79925a458b753d3b50170d047168da
7
+ data.tar.gz: 1bdc3df81c0a1a5b104a831b98ec9f2f436951d0c631985cb90fcd3b6da27272c63ba69704571ae0868c94d92704376599134adb5d5d979d7468681eb236bedb
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in marketplace.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Paper Cavalier
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ # Marketplace
2
+
3
+ This library collects the various Amazon marketplaces out there into a neat little model.
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs.push 'lib'
6
+ t.test_files = FileList['test/test_*.rb']
7
+ end
8
+
9
+ task :default => [:test]
@@ -0,0 +1,45 @@
1
+ A13V1IB3VIYZZH:
2
+ - www.amazon.fr
3
+ - FR
4
+ - EUR
5
+ - ISO-8859-1
6
+ A1F83G8C2ARO7P:
7
+ - www.amazon.co.uk
8
+ - GB
9
+ - GBP
10
+ - ISO-8859-1
11
+ A1PA6795UKMFR9:
12
+ - www.amazon.de
13
+ - DE
14
+ - EUR
15
+ - ISO-8859-1
16
+ A1RKKUPIHCS9HS:
17
+ - www.amazon.es
18
+ - ES
19
+ - EUR
20
+ - ISO-8859-1
21
+ A1VC38T7YXB528:
22
+ - www.amazon.co.jp
23
+ - JP
24
+ - JPY
25
+ - SHIFT_JIS
26
+ A21TJRUUN4KGV:
27
+ - www.amazon.in
28
+ - IN
29
+ - INR
30
+ - ISO-8859-1
31
+ A2EUQ1WTGCTBG2:
32
+ - www.amazon.ca
33
+ - CA
34
+ - CAD
35
+ - ISO-8859-1
36
+ APJ6JRA9NG5V4:
37
+ - www.amazon.it
38
+ - IT
39
+ - EUR
40
+ - ISO-8859-1
41
+ ATVPDKIKX0DER:
42
+ - www.amazon.com
43
+ - US
44
+ - USD
45
+ - ISO-8859-1
@@ -0,0 +1,24 @@
1
+ require 'yaml'
2
+
3
+ Marketplace = Struct.new(:id, :hostname, :country, :currency, :encoding) do
4
+ SEED = YAML.load_file(File.expand_path('../../config/marketplaces.yml', __FILE__)).freeze
5
+
6
+ class << self
7
+ include Enumerable
8
+
9
+ alias :all :to_a
10
+
11
+ def each
12
+ SEED.each { |attrs| yield new(*attrs.flatten) }
13
+ end
14
+
15
+ def find(id)
16
+ new(id, *SEED.fetch(id))
17
+ end
18
+ end
19
+
20
+ def initialize(*)
21
+ super
22
+ freeze
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ class Marketplace
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'marketplace/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'marketplace'
8
+ spec.version = Marketplace::VERSION
9
+ spec.authors = ['Hakan Ensari']
10
+ spec.email = ['hakan.ensari@papercavalier.com']
11
+ spec.summary = 'Amazon Marketplaces'
12
+ spec.homepage = 'https://github.com/papercavalier/marketplace'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler'
21
+ spec.add_development_dependency 'rake'
22
+ end
@@ -0,0 +1,36 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
3
+ require 'marketplace'
4
+
5
+ class TestMarketplace < Minitest::Test
6
+ def assert_marketplace(marketplace)
7
+ assert_kind_of Marketplace, marketplace
8
+ Marketplace.members.each do |member|
9
+ refute_nil marketplace.send(member)
10
+ end
11
+ end
12
+
13
+ def test_returns_all
14
+ refute_empty Marketplace.all
15
+ Marketplace.all.each do |m|
16
+ assert_marketplace m
17
+ end
18
+ end
19
+
20
+ def test_finds
21
+ m = Marketplace.find('ATVPDKIKX0DER')
22
+ assert_marketplace m
23
+ end
24
+
25
+ def test_raises_key_error
26
+ assert_raises(KeyError) { Marketplace.find('123') }
27
+ end
28
+
29
+ def test_enumerates
30
+ refute_empty Marketplace.to_a
31
+ end
32
+
33
+ def test_wont_mutate
34
+ assert Marketplace.all?(&:frozen?)
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: marketplace
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Hakan Ensari
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
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: rake
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'
41
+ description:
42
+ email:
43
+ - hakan.ensari@papercavalier.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - config/marketplaces.yml
54
+ - lib/marketplace.rb
55
+ - lib/marketplace/version.rb
56
+ - marketplace.gemspec
57
+ - test/test_marketplace.rb
58
+ homepage: https://github.com/papercavalier/marketplace
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.1.11
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Amazon Marketplaces
82
+ test_files:
83
+ - test/test_marketplace.rb