nexus_mods 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/nexus_mods/api/api_limits.rb +64 -0
- data/lib/nexus_mods/api/category.rb +54 -0
- data/lib/nexus_mods/api/game.rb +106 -0
- data/lib/nexus_mods/api/mod.rb +141 -0
- data/lib/nexus_mods/api/mod_file.rb +116 -0
- data/lib/nexus_mods/api/user.rb +55 -0
- data/lib/nexus_mods/version.rb +1 -1
- data/lib/nexus_mods.rb +12 -12
- data/spec/nexus_mods_test/factories/games.rb +135 -0
- data/spec/nexus_mods_test/factories/mod_files.rb +113 -0
- data/spec/nexus_mods_test/factories/mods.rb +144 -0
- data/spec/nexus_mods_test/helpers.rb +32 -14
- data/spec/nexus_mods_test/scenarios/nexus_mods/{api_limits_spec.rb → api/api_limits_spec.rb} +10 -3
- data/spec/nexus_mods_test/scenarios/nexus_mods/api/game_spec.rb +93 -0
- data/spec/nexus_mods_test/scenarios/nexus_mods/api/mod_file_spec.rb +73 -0
- data/spec/nexus_mods_test/scenarios/nexus_mods/api/mod_spec.rb +62 -0
- metadata +16 -13
- data/lib/nexus_mods/api_limits.rb +0 -44
- data/lib/nexus_mods/category.rb +0 -37
- data/lib/nexus_mods/game.rb +0 -78
- data/lib/nexus_mods/mod.rb +0 -106
- data/lib/nexus_mods/mod_file.rb +0 -86
- data/lib/nexus_mods/user.rb +0 -37
- data/spec/nexus_mods_test/scenarios/nexus_mods/game_spec.rb +0 -180
- data/spec/nexus_mods_test/scenarios/nexus_mods/mod_file_spec.rb +0 -140
- data/spec/nexus_mods_test/scenarios/nexus_mods/mod_spec.rb +0 -185
@@ -1,180 +0,0 @@
|
|
1
|
-
describe NexusMods::Game do
|
2
|
-
|
3
|
-
context 'when testing games' do
|
4
|
-
|
5
|
-
it 'returns the games list' do
|
6
|
-
expect_validate_user
|
7
|
-
expect_http_call_to(
|
8
|
-
path: '/v1/games.json',
|
9
|
-
json: [
|
10
|
-
{
|
11
|
-
'id' => 100,
|
12
|
-
'name' => 'Morrowind',
|
13
|
-
'forum_url' => 'https://forums.nexusmods.com/index.php?/forum/111-morrowind/',
|
14
|
-
'nexusmods_url' => 'http://www.nexusmods.com/morrowind',
|
15
|
-
'genre' => 'RPG',
|
16
|
-
'file_count' => 14_143,
|
17
|
-
'downloads' => 20_414_985,
|
18
|
-
'domain_name' => 'morrowind',
|
19
|
-
'approved_date' => 1,
|
20
|
-
'file_views' => 100_014_750,
|
21
|
-
'authors' => 2062,
|
22
|
-
'file_endorsements' => 719_262,
|
23
|
-
'mods' => 6080,
|
24
|
-
'categories' => [
|
25
|
-
{
|
26
|
-
'category_id' => 1,
|
27
|
-
'name' => 'Morrowind',
|
28
|
-
'parent_category' => false
|
29
|
-
},
|
30
|
-
{
|
31
|
-
'category_id' => 2,
|
32
|
-
'name' => 'Buildings',
|
33
|
-
'parent_category' => 1
|
34
|
-
}
|
35
|
-
]
|
36
|
-
},
|
37
|
-
{
|
38
|
-
'id' => 101,
|
39
|
-
'name' => 'Oblivion',
|
40
|
-
'forum_url' => 'https://forums.nexusmods.com/index.php?/forum/131-oblivion/',
|
41
|
-
'nexusmods_url' => 'http://www.nexusmods.com/oblivion',
|
42
|
-
'genre' => 'RPG',
|
43
|
-
'file_count' => 52_775,
|
44
|
-
'downloads' => 187_758_634,
|
45
|
-
'domain_name' => 'oblivion',
|
46
|
-
'approved_date' => 1,
|
47
|
-
'file_views' => 880_508_188,
|
48
|
-
'authors' => 10_673,
|
49
|
-
'file_endorsements' => 4_104_067,
|
50
|
-
'mods' => 29_220,
|
51
|
-
'categories' => [
|
52
|
-
{
|
53
|
-
'category_id' => 20,
|
54
|
-
'name' => 'Oblivion',
|
55
|
-
'parent_category' => false
|
56
|
-
},
|
57
|
-
{
|
58
|
-
'category_id' => 22,
|
59
|
-
'name' => 'New structures - Buildings',
|
60
|
-
'parent_category' => 20
|
61
|
-
}
|
62
|
-
]
|
63
|
-
}
|
64
|
-
]
|
65
|
-
)
|
66
|
-
games = nexus_mods.games.sort_by(&:id)
|
67
|
-
expect(games.size).to eq 2
|
68
|
-
first_game = games.first
|
69
|
-
expect(first_game.id).to eq 100
|
70
|
-
expect(first_game.name).to eq 'Morrowind'
|
71
|
-
expect(first_game.forum_url).to eq 'https://forums.nexusmods.com/index.php?/forum/111-morrowind/'
|
72
|
-
expect(first_game.nexusmods_url).to eq 'http://www.nexusmods.com/morrowind'
|
73
|
-
expect(first_game.genre).to eq 'RPG'
|
74
|
-
expect(first_game.files_count).to eq 14_143
|
75
|
-
expect(first_game.downloads_count).to eq 20_414_985
|
76
|
-
expect(first_game.domain_name).to eq 'morrowind'
|
77
|
-
expect(first_game.approved_date).to eq Time.parse('1970-01-01 00:00:01 +0000')
|
78
|
-
expect(first_game.files_views).to eq 100_014_750
|
79
|
-
expect(first_game.authors_count).to eq 2062
|
80
|
-
expect(first_game.files_endorsements).to eq 719_262
|
81
|
-
expect(first_game.mods_count).to eq 6080
|
82
|
-
first_game_categories = first_game.categories
|
83
|
-
expect(first_game_categories.size).to eq 2
|
84
|
-
expect(first_game_categories.first.id).to eq 1
|
85
|
-
expect(first_game_categories.first.name).to eq 'Morrowind'
|
86
|
-
expect(first_game_categories.first.parent_category).to be_nil
|
87
|
-
expect(first_game_categories[1].id).to eq 2
|
88
|
-
expect(first_game_categories[1].name).to eq 'Buildings'
|
89
|
-
expect(first_game_categories[1].parent_category).not_to be_nil
|
90
|
-
expect(first_game_categories[1].parent_category.id).to eq 1
|
91
|
-
expect(first_game_categories[1].parent_category.name).to eq 'Morrowind'
|
92
|
-
expect(first_game_categories[1].parent_category.parent_category).to be_nil
|
93
|
-
second_game = games[1]
|
94
|
-
expect(second_game.id).to eq 101
|
95
|
-
expect(second_game.name).to eq 'Oblivion'
|
96
|
-
expect(second_game.forum_url).to eq 'https://forums.nexusmods.com/index.php?/forum/131-oblivion/'
|
97
|
-
expect(second_game.nexusmods_url).to eq 'http://www.nexusmods.com/oblivion'
|
98
|
-
expect(second_game.genre).to eq 'RPG'
|
99
|
-
expect(second_game.files_count).to eq 52_775
|
100
|
-
expect(second_game.downloads_count).to eq 187_758_634
|
101
|
-
expect(second_game.domain_name).to eq 'oblivion'
|
102
|
-
expect(second_game.approved_date).to eq Time.parse('1970-01-01 00:00:01 +0000')
|
103
|
-
expect(second_game.files_views).to eq 880_508_188
|
104
|
-
expect(second_game.authors_count).to eq 10_673
|
105
|
-
expect(second_game.files_endorsements).to eq 4_104_067
|
106
|
-
expect(second_game.mods_count).to eq 29_220
|
107
|
-
second_game_categories = second_game.categories
|
108
|
-
expect(second_game_categories.size).to eq 2
|
109
|
-
expect(second_game_categories.first.id).to eq 20
|
110
|
-
expect(second_game_categories.first.name).to eq 'Oblivion'
|
111
|
-
expect(second_game_categories.first.parent_category).to be_nil
|
112
|
-
expect(second_game_categories[1].id).to eq 22
|
113
|
-
expect(second_game_categories[1].name).to eq 'New structures - Buildings'
|
114
|
-
expect(second_game_categories[1].parent_category).not_to be_nil
|
115
|
-
expect(second_game_categories[1].parent_category.id).to eq 20
|
116
|
-
expect(second_game_categories[1].parent_category.name).to eq 'Oblivion'
|
117
|
-
expect(second_game_categories[1].parent_category.parent_category).to be_nil
|
118
|
-
end
|
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
|
-
|
178
|
-
end
|
179
|
-
|
180
|
-
end
|
@@ -1,140 +0,0 @@
|
|
1
|
-
describe NexusMods::ModFile do
|
2
|
-
|
3
|
-
context 'when testing mod files' do
|
4
|
-
|
5
|
-
# Example of JSON object returned by the API for a mod files list
|
6
|
-
let(:json_example_mod_files) do
|
7
|
-
[
|
8
|
-
{
|
9
|
-
'id' => [
|
10
|
-
2472,
|
11
|
-
1704
|
12
|
-
],
|
13
|
-
'uid' => 7_318_624_274_856,
|
14
|
-
'file_id' => 2472,
|
15
|
-
'name' => 'ApachiiSkyHair_v_1_6_Full',
|
16
|
-
'version' => '1.6.Full',
|
17
|
-
'category_id' => 4,
|
18
|
-
'category_name' => 'OLD_VERSION',
|
19
|
-
'is_primary' => false,
|
20
|
-
'file_name' => 'ApachiiSkyHair_v_1_6_Full-2014-1-6-Full.7z',
|
21
|
-
'uploaded_timestamp' => 1_477_967_645,
|
22
|
-
'uploaded_time' => '2016-11-01T02:34:05.000+00:00',
|
23
|
-
'mod_version' => '1.6.Full',
|
24
|
-
'external_virus_scan_url' => 'https://www.virustotal.com/file/3dcc96dce0b846ea643d626c48bd6ad08752da8232f3d29be644d36e1fd627cf/analysis/1477978674/',
|
25
|
-
'description' => '[b][color=orange] NOT optimized meshes. Standalone. Adds 42 new hairstyles for females, 21 hair for males and 5 hairs for Female Khajiit- 2 hairs for Male Khajiit[/color][/b] ',
|
26
|
-
'size' => 304_347,
|
27
|
-
'size_kb' => 304_347,
|
28
|
-
'size_in_bytes' => 309_251_227,
|
29
|
-
'changelog_html' => nil,
|
30
|
-
'content_preview_link' => 'https://file-metadata.nexusmods.com/file/nexus-files-meta/1704/2014/ApachiiSkyHair_v_1_6_Full-2014-1-6-Full.7z.json'
|
31
|
-
},
|
32
|
-
{
|
33
|
-
'id' => [
|
34
|
-
2487,
|
35
|
-
1705
|
36
|
-
],
|
37
|
-
'uid' => 7_318_624_274_857,
|
38
|
-
'file_id' => 2487,
|
39
|
-
'name' => 'ApachiiSkyHairMale_v_1_2',
|
40
|
-
'version' => '1.2',
|
41
|
-
'category_id' => 4,
|
42
|
-
'category_name' => 'OLD_VERSION',
|
43
|
-
'is_primary' => false,
|
44
|
-
'file_name' => 'ApachiiSkyHairMale_v_1_2-2014-1-2.7z',
|
45
|
-
'uploaded_timestamp' => 1_477_968_373,
|
46
|
-
'uploaded_time' => '2016-11-01T02:46:13.000+00:00',
|
47
|
-
'mod_version' => '1.2',
|
48
|
-
'external_virus_scan_url' => 'https://www.virustotal.com/file/3e86106233499ac43383c32ce4a2d8e162dc6e940b4d228f649a701b71ee5676/analysis/1477979366/',
|
49
|
-
'description' => 'NOT optimezed meshes. Standalone 55 Male hairs - Not included in ApachiiSkyHair v_1_6_Full ',
|
50
|
-
'size' => 204_347,
|
51
|
-
'size_kb' => 204_347,
|
52
|
-
'size_in_bytes' => 209_251_227,
|
53
|
-
'changelog_html' => nil,
|
54
|
-
'content_preview_link' => 'https://file-metadata.nexusmods.com/file/nexus-files-meta/1704/2014/ApachiiSkyHairMale_v_1_2-2014-1-2.7z.json'
|
55
|
-
}
|
56
|
-
]
|
57
|
-
end
|
58
|
-
|
59
|
-
# Expect a mod's files to be the example ones
|
60
|
-
#
|
61
|
-
# Parameters::
|
62
|
-
# * *mod_files* (Array<NexusMods::File>): List of files to validate
|
63
|
-
def expect_mod_files_to_be_example(mod_files)
|
64
|
-
expect(mod_files.size).to eq 2
|
65
|
-
sorted_mod_files = mod_files.sort_by(&:id)
|
66
|
-
first_mod_file = sorted_mod_files.first
|
67
|
-
expect(first_mod_file.ids).to eq [2472, 1704]
|
68
|
-
expect(first_mod_file.uid).to eq 7_318_624_274_856
|
69
|
-
expect(first_mod_file.id).to eq 2472
|
70
|
-
expect(first_mod_file.name).to eq 'ApachiiSkyHair_v_1_6_Full'
|
71
|
-
expect(first_mod_file.version).to eq '1.6.Full'
|
72
|
-
expect(first_mod_file.category_id).to eq :old
|
73
|
-
expect(first_mod_file.category_name).to eq 'OLD_VERSION'
|
74
|
-
expect(first_mod_file.is_primary).to be false
|
75
|
-
expect(first_mod_file.size).to eq 309_251_227
|
76
|
-
expect(first_mod_file.file_name).to eq 'ApachiiSkyHair_v_1_6_Full-2014-1-6-Full.7z'
|
77
|
-
expect(first_mod_file.uploaded_time).to eq Time.parse('2016-11-01T02:34:05.000+00:00')
|
78
|
-
expect(first_mod_file.mod_version).to eq '1.6.Full'
|
79
|
-
expect(first_mod_file.external_virus_scan_url).to eq 'https://www.virustotal.com/file/3dcc96dce0b846ea643d626c48bd6ad08752da8232f3d29be644d36e1fd627cf/analysis/1477978674/'
|
80
|
-
expect(first_mod_file.description).to eq '[b][color=orange] NOT optimized meshes. Standalone. Adds 42 new hairstyles for females, 21 hair for males and 5 hairs for Female Khajiit- 2 hairs for Male Khajiit[/color][/b] '
|
81
|
-
expect(first_mod_file.changelog_html).to be_nil
|
82
|
-
expect(first_mod_file.content_preview_url).to eq 'https://file-metadata.nexusmods.com/file/nexus-files-meta/1704/2014/ApachiiSkyHair_v_1_6_Full-2014-1-6-Full.7z.json'
|
83
|
-
second_mod_file = sorted_mod_files[1]
|
84
|
-
expect(second_mod_file.ids).to eq [2487, 1705]
|
85
|
-
expect(second_mod_file.uid).to eq 7_318_624_274_857
|
86
|
-
expect(second_mod_file.id).to eq 2487
|
87
|
-
expect(second_mod_file.name).to eq 'ApachiiSkyHairMale_v_1_2'
|
88
|
-
expect(second_mod_file.version).to eq '1.2'
|
89
|
-
expect(second_mod_file.category_id).to eq :old
|
90
|
-
expect(second_mod_file.category_name).to eq 'OLD_VERSION'
|
91
|
-
expect(second_mod_file.is_primary).to be false
|
92
|
-
expect(second_mod_file.size).to eq 209_251_227
|
93
|
-
expect(second_mod_file.file_name).to eq 'ApachiiSkyHairMale_v_1_2-2014-1-2.7z'
|
94
|
-
expect(second_mod_file.uploaded_time).to eq Time.parse('2016-11-01T02:46:13.000+00:00')
|
95
|
-
expect(second_mod_file.mod_version).to eq '1.2'
|
96
|
-
expect(second_mod_file.external_virus_scan_url).to eq 'https://www.virustotal.com/file/3e86106233499ac43383c32ce4a2d8e162dc6e940b4d228f649a701b71ee5676/analysis/1477979366/'
|
97
|
-
expect(second_mod_file.description).to eq 'NOT optimezed meshes. Standalone 55 Male hairs - Not included in ApachiiSkyHair v_1_6_Full '
|
98
|
-
expect(second_mod_file.changelog_html).to be_nil
|
99
|
-
expect(second_mod_file.content_preview_url).to eq 'https://file-metadata.nexusmods.com/file/nexus-files-meta/1704/2014/ApachiiSkyHairMale_v_1_2-2014-1-2.7z.json'
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'returns a mod files list' do
|
103
|
-
expect_validate_user
|
104
|
-
expect_http_call_to(
|
105
|
-
path: '/v1/games/skyrimspecialedition/mods/2014/files.json',
|
106
|
-
json: { files: json_example_mod_files }
|
107
|
-
)
|
108
|
-
expect_mod_files_to_be_example(nexus_mods.mod_files(game_domain_name: 'skyrimspecialedition', mod_id: 2014))
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'returns the default mod files list' do
|
112
|
-
expect_validate_user
|
113
|
-
expect_http_call_to(
|
114
|
-
path: '/v1/games/skyrimspecialedition/mods/2014/files.json',
|
115
|
-
json: { files: json_example_mod_files }
|
116
|
-
)
|
117
|
-
expect_mod_files_to_be_example(nexus_mods(mod_id: 2014).mod_files(game_domain_name: 'skyrimspecialedition'))
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'returns mod files list for the default game' do
|
121
|
-
expect_validate_user
|
122
|
-
expect_http_call_to(
|
123
|
-
path: '/v1/games/skyrimspecialedition/mods/2014/files.json',
|
124
|
-
json: { files: json_example_mod_files }
|
125
|
-
)
|
126
|
-
expect_mod_files_to_be_example(nexus_mods(game_domain_name: 'skyrimspecialedition').mod_files(mod_id: 2014))
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'returns mod files list for the default game and mod' do
|
130
|
-
expect_validate_user
|
131
|
-
expect_http_call_to(
|
132
|
-
path: '/v1/games/skyrimspecialedition/mods/2014/files.json',
|
133
|
-
json: { files: json_example_mod_files }
|
134
|
-
)
|
135
|
-
expect_mod_files_to_be_example(nexus_mods(game_domain_name: 'skyrimspecialedition', mod_id: 2014).mod_files)
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
end
|
@@ -1,185 +0,0 @@
|
|
1
|
-
describe NexusMods::Mod do
|
2
|
-
|
3
|
-
context 'when testing mods' do
|
4
|
-
|
5
|
-
# Example of JSON object returned by the API for a mod information, having all possible fields
|
6
|
-
let(:json_complete_mod) do
|
7
|
-
{
|
8
|
-
'name' => 'ApachiiSkyHair SSE',
|
9
|
-
'summary' => 'New Female and Male Hairstyles for Humans, Elves and Orcs. Converted hair from Sims2 and Sims3.<br />Standalone version.',
|
10
|
-
'description' => 'Mod description',
|
11
|
-
'picture_url' => 'https://staticdelivery.nexusmods.com/mods/1704/images/10168-1-1392817986.jpg',
|
12
|
-
'mod_downloads' => 13_634_545,
|
13
|
-
'mod_unique_downloads' => 4_052_221,
|
14
|
-
'uid' => 7_318_624_272_650,
|
15
|
-
'mod_id' => 2014,
|
16
|
-
'game_id' => 1704,
|
17
|
-
'allow_rating' => true,
|
18
|
-
'domain_name' => 'skyrimspecialedition',
|
19
|
-
'category_id' => 26,
|
20
|
-
'version' => '1.6.Full',
|
21
|
-
'endorsement_count' => 298_845,
|
22
|
-
'created_timestamp' => 1_477_972_056,
|
23
|
-
'created_time' => '2016-11-01T03:47:36.000+00:00',
|
24
|
-
'updated_timestamp' => 1_507_398_546,
|
25
|
-
'updated_time' => '2017-10-07T17:49:06.000+00:00',
|
26
|
-
'author' => 'Apachii',
|
27
|
-
'uploaded_by' => 'apachii',
|
28
|
-
'uploaded_users_profile_url' => 'http://www.nexusmods.com/games/users/283148',
|
29
|
-
'contains_adult_content' => false,
|
30
|
-
'status' => 'published',
|
31
|
-
'available' => true,
|
32
|
-
'user' => {
|
33
|
-
'member_id' => 283_148,
|
34
|
-
'member_group_id' => 27,
|
35
|
-
'name' => 'apachii'
|
36
|
-
},
|
37
|
-
'endorsement' => {
|
38
|
-
'endorse_status' => 'Undecided',
|
39
|
-
'timestamp' => nil,
|
40
|
-
'version' => nil
|
41
|
-
}
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
# Example of JSON object returned by the API for a mod information, having minimum fields
|
46
|
-
let(:json_partial_mod) do
|
47
|
-
{
|
48
|
-
'mod_downloads' => 13_634_545,
|
49
|
-
'mod_unique_downloads' => 4_052_221,
|
50
|
-
'uid' => 7_318_624_272_650,
|
51
|
-
'mod_id' => 2014,
|
52
|
-
'game_id' => 1704,
|
53
|
-
'allow_rating' => true,
|
54
|
-
'domain_name' => 'skyrimspecialedition',
|
55
|
-
'category_id' => 26,
|
56
|
-
'version' => '1.6.Full',
|
57
|
-
'endorsement_count' => 298_845,
|
58
|
-
'created_timestamp' => 1_477_972_056,
|
59
|
-
'created_time' => '2016-11-01T03:47:36.000+00:00',
|
60
|
-
'updated_timestamp' => 1_507_398_546,
|
61
|
-
'updated_time' => '2017-10-07T17:49:06.000+00:00',
|
62
|
-
'author' => 'Apachii',
|
63
|
-
'uploaded_by' => 'apachii',
|
64
|
-
'uploaded_users_profile_url' => 'http://www.nexusmods.com/games/users/283148',
|
65
|
-
'contains_adult_content' => false,
|
66
|
-
'status' => 'published',
|
67
|
-
'available' => true,
|
68
|
-
'user' => {
|
69
|
-
'member_id' => 283_148,
|
70
|
-
'member_group_id' => 27,
|
71
|
-
'name' => 'apachii'
|
72
|
-
}
|
73
|
-
}
|
74
|
-
end
|
75
|
-
|
76
|
-
# Expect a mod to be the example complete one
|
77
|
-
#
|
78
|
-
# Parameters::
|
79
|
-
# * *mod* (NexusMods::Mod): Mod to validate
|
80
|
-
def expect_mod_to_be_complete(mod)
|
81
|
-
expect(mod.name).to eq 'ApachiiSkyHair SSE'
|
82
|
-
expect(mod.summary).to eq 'New Female and Male Hairstyles for Humans, Elves and Orcs. Converted hair from Sims2 and Sims3.<br />Standalone version.'
|
83
|
-
expect(mod.description).to eq 'Mod description'
|
84
|
-
expect(mod.picture_url).to eq 'https://staticdelivery.nexusmods.com/mods/1704/images/10168-1-1392817986.jpg'
|
85
|
-
expect(mod.downloads_count).to eq 13_634_545
|
86
|
-
expect(mod.unique_downloads_count).to eq 4_052_221
|
87
|
-
expect(mod.uid).to eq 7_318_624_272_650
|
88
|
-
expect(mod.mod_id).to eq 2014
|
89
|
-
expect(mod.game_id).to eq 1704
|
90
|
-
expect(mod.allow_rating).to be true
|
91
|
-
expect(mod.domain_name).to eq 'skyrimspecialedition'
|
92
|
-
expect(mod.category_id).to eq 26
|
93
|
-
expect(mod.version).to eq '1.6.Full'
|
94
|
-
expect(mod.endorsements_count).to eq 298_845
|
95
|
-
expect(mod.created_time).to eq Time.parse('2016-11-01T03:47:36.000+00:00')
|
96
|
-
expect(mod.updated_time).to eq Time.parse('2017-10-07T17:49:06.000+00:00')
|
97
|
-
expect(mod.author).to eq 'Apachii'
|
98
|
-
expect(mod.contains_adult_content).to be false
|
99
|
-
expect(mod.status).to eq 'published'
|
100
|
-
expect(mod.available).to be true
|
101
|
-
expect(mod.uploader.member_id).to eq 283_148
|
102
|
-
expect(mod.uploader.member_group_id).to eq 27
|
103
|
-
expect(mod.uploader.name).to eq 'apachii'
|
104
|
-
expect(mod.uploader.profile_url).to eq 'http://www.nexusmods.com/games/users/283148'
|
105
|
-
end
|
106
|
-
|
107
|
-
# Expect a mod to be the example partial one
|
108
|
-
#
|
109
|
-
# Parameters::
|
110
|
-
# * *mod* (NexusMods::Mod): Mod to validate
|
111
|
-
def expect_mod_to_be_partial(mod)
|
112
|
-
expect(mod.name).to be_nil
|
113
|
-
expect(mod.summary).to be_nil
|
114
|
-
expect(mod.description).to be_nil
|
115
|
-
expect(mod.picture_url).to be_nil
|
116
|
-
expect(mod.downloads_count).to eq 13_634_545
|
117
|
-
expect(mod.unique_downloads_count).to eq 4_052_221
|
118
|
-
expect(mod.uid).to eq 7_318_624_272_650
|
119
|
-
expect(mod.mod_id).to eq 2014
|
120
|
-
expect(mod.game_id).to eq 1704
|
121
|
-
expect(mod.allow_rating).to be true
|
122
|
-
expect(mod.domain_name).to eq 'skyrimspecialedition'
|
123
|
-
expect(mod.category_id).to eq 26
|
124
|
-
expect(mod.version).to eq '1.6.Full'
|
125
|
-
expect(mod.endorsements_count).to eq 298_845
|
126
|
-
expect(mod.created_time).to eq Time.parse('2016-11-01T03:47:36.000+00:00')
|
127
|
-
expect(mod.updated_time).to eq Time.parse('2017-10-07T17:49:06.000+00:00')
|
128
|
-
expect(mod.author).to eq 'Apachii'
|
129
|
-
expect(mod.contains_adult_content).to be false
|
130
|
-
expect(mod.status).to eq 'published'
|
131
|
-
expect(mod.available).to be true
|
132
|
-
expect(mod.uploader.member_id).to eq 283_148
|
133
|
-
expect(mod.uploader.member_group_id).to eq 27
|
134
|
-
expect(mod.uploader.name).to eq 'apachii'
|
135
|
-
expect(mod.uploader.profile_url).to eq 'http://www.nexusmods.com/games/users/283148'
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'returns a mod complete information' do
|
139
|
-
expect_validate_user
|
140
|
-
expect_http_call_to(
|
141
|
-
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
142
|
-
json: json_complete_mod
|
143
|
-
)
|
144
|
-
expect_mod_to_be_complete(nexus_mods.mod(game_domain_name: 'skyrimspecialedition', mod_id: 2014))
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'returns a mod partial information' do
|
148
|
-
expect_validate_user
|
149
|
-
expect_http_call_to(
|
150
|
-
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
151
|
-
json: json_partial_mod
|
152
|
-
)
|
153
|
-
expect_mod_to_be_partial(nexus_mods.mod(game_domain_name: 'skyrimspecialedition', mod_id: 2014))
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'returns the default mod information' do
|
157
|
-
expect_validate_user
|
158
|
-
expect_http_call_to(
|
159
|
-
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
160
|
-
json: json_complete_mod
|
161
|
-
)
|
162
|
-
expect_mod_to_be_complete(nexus_mods(mod_id: 2014).mod(game_domain_name: 'skyrimspecialedition'))
|
163
|
-
end
|
164
|
-
|
165
|
-
it 'returns mod information for the default game' do
|
166
|
-
expect_validate_user
|
167
|
-
expect_http_call_to(
|
168
|
-
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
169
|
-
json: json_complete_mod
|
170
|
-
)
|
171
|
-
expect_mod_to_be_complete(nexus_mods(game_domain_name: 'skyrimspecialedition').mod(mod_id: 2014))
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'returns mod information for the default game and mod' do
|
175
|
-
expect_validate_user
|
176
|
-
expect_http_call_to(
|
177
|
-
path: '/v1/games/skyrimspecialedition/mods/2014.json',
|
178
|
-
json: json_complete_mod
|
179
|
-
)
|
180
|
-
expect_mod_to_be_complete(nexus_mods(game_domain_name: 'skyrimspecialedition', mod_id: 2014).mod)
|
181
|
-
end
|
182
|
-
|
183
|
-
end
|
184
|
-
|
185
|
-
end
|