nintendo_eshop 0.1.0.alpha1 → 0.1.0.alpha2

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: 61dd76f0dea8e749bcdc061fabf0665e4c3d732543a965369cd0f164f1433561
4
- data.tar.gz: 762525c29b7db3d53acbd23f2e9e43b5bbeea2450ff43069c06e014be12dfe65
3
+ metadata.gz: c16722724063cfd735832cc6a1e058bbeb6023b87c6856421c7f20887eee90db
4
+ data.tar.gz: 6877920b5fd9c9a4dc4fbedeb12e6284212becb77c616631754eaedb306a64f4
5
5
  SHA512:
6
- metadata.gz: d44317428360508973e8dada8664351533bded7c86b80978b383481105bdd3069b4a8c778e8fab289ef2d848f42dcf34e0db3c1d9773d465bcf951f5d38f7eca
7
- data.tar.gz: 9f9b84276ae3351203f508f6b7844bfbb201f3f29f7e6d5de9ec31e5a14e4c0f846296d5bdf7d768b3f4fc9f76266d4e71b52566990244f8f6724396c1f39e66
6
+ metadata.gz: fc2c84062048e4a562cc0809e805175c2cff2ba134ad1d213522859c849d694c9764bf41e3af74d1ac2796d3ed92562df96e0a278624ceceb101944c5b799431
7
+ data.tar.gz: cf726caaac49676c462818ea3f7b8facb51ae3e1968ccd27230ea546d1a3d4b469a4bb969f1a74838c846c6b9148ea62a0e70a48f44c25fcef7a08d794ef599e
data/.circleci/config.yml CHANGED
@@ -5,6 +5,8 @@
5
5
  version: 2
6
6
  jobs:
7
7
  build:
8
+ environment:
9
+ CC_TEST_REPORTER_ID: edcfd6157a2c4f277783e772ad6d2f2fb355fc22a0a39279ca95d4627d1277ad
8
10
  docker:
9
11
  # specify the version you desire here
10
12
  - image: circleci/ruby:2.4.6
@@ -37,10 +39,16 @@ jobs:
37
39
  key: v1-dependencies-{{ checksum "Gemfile.lock" }}
38
40
 
39
41
  # run tests!
42
+ - run:
43
+ name: Install Code Climate Test Reporter
44
+ command: |
45
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
46
+ chmod +x ./cc-test-reporter
40
47
  - run:
41
48
  name: run tests
42
49
  command: |
43
50
  mkdir /tmp/test-results
51
+ ./cc-test-reporter before-build
44
52
  TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
45
53
  circleci tests split --split-by=timings)"
46
54
 
@@ -48,6 +56,10 @@ jobs:
48
56
  --format RspecJunitFormatter \
49
57
  --out /tmp/test-results/rspec.xml \
50
58
  $TEST_FILES
59
+ - run:
60
+ name: Code Climate Test Coverage
61
+ command: |
62
+ ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
51
63
 
52
64
  # collect reports
53
65
  - store_test_results:
@@ -55,6 +67,9 @@ jobs:
55
67
  - store_artifacts:
56
68
  path: /tmp/test-results
57
69
  destination: test-results
70
+ - deploy:
71
+ command: |
72
+ ./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
58
73
  deploy:
59
74
  docker:
60
75
  - image: circleci/ruby:2.4.6
data/.codeclimate.yml ADDED
@@ -0,0 +1,11 @@
1
+ version: "2"
2
+ prepare:
3
+ fetch:
4
+ - url: "https://raw.githubusercontent.com/RamseyInHouse/ramsey-cop/master/default.yml"
5
+ path: "alternate-rubocop-path.yml"
6
+ plugins:
7
+ rubocop:
8
+ enabled: true
9
+ channel: "rubocop-0-67"
10
+ config:
11
+ file: "alternate-rubocop-path.yml"
data/.rspec_status CHANGED
@@ -1,5 +1,5 @@
1
1
  example_id | status | run_time |
2
2
  ----------------------------------------- | ------ | --------------- |
3
- ./spec/nintendo_eshop/game_spec.rb[1:1:1] | passed | 0.00598 seconds |
4
- ./spec/nintendo_eshop/game_spec.rb[1:1:2] | passed | 0.00382 seconds |
5
- ./spec/nintendo_eshop_spec.rb[1:1] | passed | 0.00038 seconds |
3
+ ./spec/nintendo_eshop/game_spec.rb[1:1:1] | passed | 0.00568 seconds |
4
+ ./spec/nintendo_eshop/game_spec.rb[1:1:2] | passed | 0.0112 seconds |
5
+ ./spec/nintendo_eshop_spec.rb[1:1] | passed | 0.00086 seconds |
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nintendo_eshop (0.1.0.alpha1)
4
+ nintendo_eshop (0.1.0.alpha2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -17,9 +17,11 @@ GEM
17
17
  debase-ruby_core_source (>= 0.10.2)
18
18
  debase-ruby_core_source (0.10.5)
19
19
  diff-lcs (1.3)
20
+ docile (1.3.2)
20
21
  hashdiff (0.4.0)
21
22
  htmlentities (4.3.4)
22
23
  jaro_winkler (1.5.3)
24
+ json (2.2.0)
23
25
  kramdown (1.17.0)
24
26
  method_source (0.9.2)
25
27
  mini_portile2 (2.4.0)
@@ -33,7 +35,7 @@ GEM
33
35
  method_source (~> 0.9.0)
34
36
  public_suffix (3.1.0)
35
37
  rainbow (3.0.0)
36
- rake (10.5.0)
38
+ rake (12.3.2)
37
39
  ramsey_cop (0.14.0)
38
40
  rubocop (~> 0.62)
39
41
  rubocop-performance
@@ -67,6 +69,11 @@ GEM
67
69
  rake (>= 0.8.1)
68
70
  ruby-progressbar (1.10.1)
69
71
  safe_yaml (1.0.5)
72
+ simplecov (0.16.1)
73
+ docile (~> 1.1)
74
+ json (>= 1.8, < 3)
75
+ simplecov-html (~> 0.10.0)
76
+ simplecov-html (0.10.2)
70
77
  solargraph (0.33.2)
71
78
  backport (~> 1.1)
72
79
  bundler (>= 1.17.2)
@@ -96,11 +103,12 @@ DEPENDENCIES
96
103
  debase
97
104
  nintendo_eshop!
98
105
  pry
99
- rake (~> 10.0)
106
+ rake (~> 12.3)
100
107
  ramsey_cop
101
108
  rspec (~> 3.0)
102
109
  rspec_junit_formatter
103
110
  ruby-debug-ide
111
+ simplecov
104
112
  solargraph
105
113
  webmock
106
114
 
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Nintendo eShop
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/nintendo_eshop.svg)](https://badge.fury.io/rb/nintendo_eshop)
3
4
  [![CircleCI](https://circleci.com/gh/rickpeyton/nintendo_eshop.svg?style=svg)](https://circleci.com/gh/rickpeyton/nintendo_eshop)
4
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/5e41e08d88dbecfcf318/maintainability)](https://codeclimate.com/github/rickpeyton/nintendo_eshop/maintainability)
5
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/5e41e08d88dbecfcf318/test_coverage)](https://codeclimate.com/github/rickpeyton/nintendo_eshop/test_coverage)
@@ -34,11 +35,10 @@ NintendoEshop.base_url = "https://u3b6gr4ua3-dsn.algolia.net"
34
35
  NintendoEshop.api_key = "9a20c93440cf63cf1a7008d75f7438bf"
35
36
  NintendoEshop.app_id = "U3B6GR4UA3"
36
37
 
37
- game = NintendoEshop::Game.retrieve("3ce3fb54-5f95-3a24-9101-7faa694c4b6f")
38
+ game = NintendoEshop::Game.retrieve("70010000001130")
38
39
 
39
40
  game.art # "/content/dam/noa/en_US/games/switch/s/super-mario-odyssey-switch/Switch_SuperMarioOdyssey_box.png"
40
41
  game.current_price # 59.99
41
- game.external_key # "3ce3fb54-5f95-3a24-9101-7faa694c4b6f"
42
42
  game.id # "70010000001130"
43
43
  game.msrp # 59.99
44
44
  game.platform # "Nintendo Switch"
@@ -50,11 +50,10 @@ game.url # "/games/detail/super-mario-odyssey-switch"
50
50
  Or a game on sale
51
51
 
52
52
  ```ruby
53
- game = NintendoEshop::Game.retrieve("26322c64-9268-3a24-822e-5e10f9e5cfc9")
53
+ game = NintendoEshop::Game.retrieve("70010000001539")
54
54
 
55
55
  game.art # "/content/dam/noa/en_US/games/switch/s/sonic-forces-switch/Switch_SonicForces_box.png"
56
56
  game.current_price # 14.99
57
- game.external_key # "26322c64-9268-3a24-822e-5e10f9e5cfc9
58
57
  game.id # "70010000001539"
59
58
  game.msrp # 29.99
60
59
  game.platform # "Nintendo Switch"
@@ -1,7 +1,6 @@
1
1
  module NintendoEshop
2
2
  class Game < APIRequest
3
3
  attr_accessor :art
4
- attr_accessor :external_key
5
4
  attr_accessor :id
6
5
  attr_accessor :msrp
7
6
  attr_accessor :platform
@@ -9,15 +8,15 @@ module NintendoEshop
9
8
  attr_accessor :title
10
9
  attr_accessor :url
11
10
 
12
- RESOURCE_PATH = "/1/indexes/*/objects".freeze
11
+ RESOURCE_PATH = "/1/indexes/noa_aem_game_en_us/query".freeze
13
12
 
14
- def initialize(external_key)
15
- self.external_key = external_key
13
+ def initialize(id)
14
+ self.id = id
16
15
  end
17
16
 
18
17
  def refresh
19
18
  response = request(:post, to_json: body)
20
- result = response.dig(:results, 0)
19
+ result = response.dig(:hits, 0)
21
20
  refresh_object(result)
22
21
  self
23
22
  end
@@ -26,8 +25,8 @@ module NintendoEshop
26
25
  sale_price || msrp
27
26
  end
28
27
 
29
- def self.retrieve(external_key)
30
- instance = new(external_key)
28
+ def self.retrieve(id)
29
+ instance = new(id)
31
30
  instance.refresh
32
31
  end
33
32
 
@@ -35,19 +34,15 @@ module NintendoEshop
35
34
 
36
35
  def body
37
36
  {
38
- "requests" => [
39
- {
40
- "attributesToRetrieve" => "url,objectID,title,nsuid,salePrice,msrp,boxArt,platform",
41
- "objectID" => external_key.to_s,
42
- "indexName" => "noa_aem_game_en_us"
43
- }
37
+ "query": id.to_s,
38
+ "restrictSearchableAttributes": [
39
+ "nsuid"
44
40
  ]
45
41
  }
46
42
  end
47
43
 
48
44
  def refresh_object(result)
49
45
  self.art = result.dig(:boxArt)
50
- self.external_key = result.dig(:objectID)
51
46
  self.id = result.dig(:nsuid)
52
47
  self.msrp = result.dig(:msrp)
53
48
  self.platform = result.dig(:platform)
@@ -1,3 +1,3 @@
1
1
  module NintendoEshop
2
- VERSION = "0.1.0.alpha1".freeze
2
+ VERSION = "0.1.0.alpha2".freeze
3
3
  end
@@ -24,11 +24,12 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.17"
25
25
  spec.add_development_dependency "debase"
26
26
  spec.add_development_dependency "pry"
27
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rake", "~> 12.3"
28
28
  spec.add_development_dependency "ramsey_cop"
29
29
  spec.add_development_dependency "rspec", "~> 3.0"
30
30
  spec.add_development_dependency "rspec_junit_formatter"
31
31
  spec.add_development_dependency "ruby-debug-ide"
32
+ spec.add_development_dependency "simplecov"
32
33
  spec.add_development_dependency "solargraph"
33
34
  spec.add_development_dependency "webmock"
34
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nintendo_eshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha1
4
+ version: 0.1.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Peyton
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '12.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '12.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ramsey_cop
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: solargraph
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -159,6 +173,7 @@ extra_rdoc_files: []
159
173
  files:
160
174
  - ".circleci/config.yml"
161
175
  - ".circleci/setup-rubygems.sh"
176
+ - ".codeclimate.yml"
162
177
  - ".devcontainer/Dockerfile"
163
178
  - ".devcontainer/devcontainer.json"
164
179
  - ".gitattributes"
@@ -178,8 +193,6 @@ files:
178
193
  - lib/nintendo_eshop/game.rb
179
194
  - lib/nintendo_eshop/version.rb
180
195
  - nintendo_eshop.gemspec
181
- - test_results
182
- - test_results_xml
183
196
  homepage: https://github.com/rickpeyton/nintendo_eshop
184
197
  licenses:
185
198
  - MIT
data/test_results DELETED
@@ -1 +0,0 @@
1
- {"version":"3.8.1","examples":[{"id":"./spec/nintendo_eshop/game_spec.rb[1:1:1]","description":"retrieves a sale game from the Nintendo eShop API","full_description":"NintendoEshop::Game.retrieve retrieves a sale game from the Nintendo eShop API","status":"passed","file_path":"./spec/nintendo_eshop/game_spec.rb","line_number":3,"run_time":0.005747114,"pending_message":null},{"id":"./spec/nintendo_eshop/game_spec.rb[1:1:2]","description":"retrieves a non-sale game from the Nintendo eShop API","full_description":"NintendoEshop::Game.retrieve retrieves a non-sale game from the Nintendo eShop API","status":"passed","file_path":"./spec/nintendo_eshop/game_spec.rb","line_number":20,"run_time":0.00602694,"pending_message":null},{"id":"./spec/nintendo_eshop_spec.rb[1:1]","description":"has a version number","full_description":"NintendoEshop has a version number","status":"passed","file_path":"./spec/nintendo_eshop_spec.rb","line_number":2,"run_time":0.000361282,"pending_message":null}],"summary":{"duration":0.013353587,"example_count":3,"failure_count":0,"pending_count":0,"errors_outside_of_examples_count":0},"summary_line":"3 examples, 0 failures"}
data/test_results_xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <testsuite name="rspec" tests="3" skipped="0" failures="0" errors="0" time="0.012374" timestamp="2019-06-22T04:13:21+00:00" hostname="07feaddbd13b">
3
- <properties>
4
- <property name="seed" value="64681"/>
5
- </properties>
6
- <testcase classname="spec.nintendo_eshop.game_spec" name="NintendoEshop::Game.retrieve retrieves a sale game from the Nintendo eShop API" file="./spec/nintendo_eshop/game_spec.rb" time="0.005981"></testcase>
7
- <testcase classname="spec.nintendo_eshop.game_spec" name="NintendoEshop::Game.retrieve retrieves a non-sale game from the Nintendo eShop API" file="./spec/nintendo_eshop/game_spec.rb" time="0.003820"></testcase>
8
- <testcase classname="spec.nintendo_eshop_spec" name="NintendoEshop has a version number" file="./spec/nintendo_eshop_spec.rb" time="0.000376"></testcase>
9
- </testsuite>