nexus_mods 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09e5130895c6c436fd54ba6847b7c3cfd1e48183b03959c76797b1a469fd1685'
4
- data.tar.gz: 747d004d98a01b1dc004e36fcf513524dd64ce0dc71b5b5bb62d536e113e5cce
3
+ metadata.gz: c443ff1432283f58fd5928a67607934721bd733dd07dc5297451c990cf72ae7f
4
+ data.tar.gz: 1f29640cabaa7e862a119cb9116d1f15049af67d7eaaa51d1707e8aa99c2cdd6
5
5
  SHA512:
6
- metadata.gz: c6d6cbc5d12223741f2d6a703796fffed51db61cfa1dd94fdfb71ed68cbdce12881441d3d4dae7fee7bd85f2ccc408c45b6d427d41862814f2cbab78d49e2daf
7
- data.tar.gz: 707070691462d95c4245714cd92d959beecb86eee5ff87355a456efbed6b3a4100f06df1ee5eb0a48d83a3178abef76e1f7f4f937856180503f2f2097b06ed61
6
+ metadata.gz: 6d94ec311b0e8174052e6c7c352e868928d243c7206ffb97206e7ddf273fbb7e417b29acbc02bc0ec72b7ce1d8bc8d2622a398b8e054423f5669d5700b0a063d
7
+ data.tar.gz: 8ed74a2422c6e1109a90859bd5a66b5c440ce9cab86f17aaa2d52821bd1715040aab4031f9a4b879031fae7c03b449515ecdb1ea35683f293ee867252426ded7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [v0.1.1](https://github.com/Muriel-Salvan/nexus_mods/compare/v0.1.0...v0.1.1) (2023-03-27 19:57:47)
2
+
3
+ ### Patches
4
+
5
+ * [Support games having categories without parent category](https://github.com/Muriel-Salvan/nexus_mods/commit/eb19cf5edc424e82df72b7dc0092fa49d24368de)
6
+
1
7
  # [v0.1.0](https://github.com/Muriel-Salvan/nexus_mods/compare/v0.0.1...v0.1.0) (2023-03-26 17:37:15)
2
8
 
3
9
  ### Patches
@@ -1,5 +1,5 @@
1
1
  class NexusMods
2
2
 
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
 
5
5
  end
data/lib/nexus_mods.rb CHANGED
@@ -107,7 +107,8 @@ class NexusMods
107
107
  ]
108
108
  end
109
109
  categories.each_value do |(category, parent_category_id)|
110
- category.parent_category = categories[parent_category_id].first if parent_category_id
110
+ # Ignore missing parent categories: this situation happens.
111
+ category.parent_category = categories[parent_category_id]&.first if parent_category_id
111
112
  end
112
113
  Game.new(
113
114
  id: game_json['id'],
@@ -117,6 +117,64 @@ describe NexusMods::Game do
117
117
  expect(second_game_categories[1].parent_category.parent_category).to be_nil
118
118
  end
119
119
 
120
+ it 'returns a game having missing parent category' do
121
+ expect_validate_user
122
+ expect_http_call_to(
123
+ path: '/v1/games.json',
124
+ json: [
125
+ {
126
+ 'id' => 100,
127
+ 'name' => 'Morrowind',
128
+ 'forum_url' => 'https://forums.nexusmods.com/index.php?/forum/111-morrowind/',
129
+ 'nexusmods_url' => 'http://www.nexusmods.com/morrowind',
130
+ 'genre' => 'RPG',
131
+ 'file_count' => 14_143,
132
+ 'downloads' => 20_414_985,
133
+ 'domain_name' => 'morrowind',
134
+ 'approved_date' => 1,
135
+ 'file_views' => 100_014_750,
136
+ 'authors' => 2062,
137
+ 'file_endorsements' => 719_262,
138
+ 'mods' => 6080,
139
+ 'categories' => [
140
+ {
141
+ 'category_id' => 1,
142
+ 'name' => 'Morrowind',
143
+ 'parent_category' => false
144
+ },
145
+ {
146
+ 'category_id' => 2,
147
+ 'name' => 'Buildings',
148
+ 'parent_category' => 3
149
+ }
150
+ ]
151
+ }
152
+ ]
153
+ )
154
+ game = nexus_mods.games.first
155
+ expect(game.id).to eq 100
156
+ expect(game.name).to eq 'Morrowind'
157
+ expect(game.forum_url).to eq 'https://forums.nexusmods.com/index.php?/forum/111-morrowind/'
158
+ expect(game.nexusmods_url).to eq 'http://www.nexusmods.com/morrowind'
159
+ expect(game.genre).to eq 'RPG'
160
+ expect(game.files_count).to eq 14_143
161
+ expect(game.downloads_count).to eq 20_414_985
162
+ expect(game.domain_name).to eq 'morrowind'
163
+ expect(game.approved_date).to eq Time.parse('1970-01-01 00:00:01 +0000')
164
+ expect(game.files_views).to eq 100_014_750
165
+ expect(game.authors_count).to eq 2062
166
+ expect(game.files_endorsements).to eq 719_262
167
+ expect(game.mods_count).to eq 6080
168
+ game_categories = game.categories
169
+ expect(game_categories.size).to eq 2
170
+ expect(game_categories.first.id).to eq 1
171
+ expect(game_categories.first.name).to eq 'Morrowind'
172
+ expect(game_categories.first.parent_category).to be_nil
173
+ expect(game_categories[1].id).to eq 2
174
+ expect(game_categories[1].name).to eq 'Buildings'
175
+ expect(game_categories[1].parent_category).to be_nil
176
+ end
177
+
120
178
  end
121
179
 
122
180
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexus_mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-26 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday