nexus_mods 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '09e5130895c6c436fd54ba6847b7c3cfd1e48183b03959c76797b1a469fd1685'
4
+ data.tar.gz: 747d004d98a01b1dc004e36fcf513524dd64ce0dc71b5b5bb62d536e113e5cce
5
+ SHA512:
6
+ metadata.gz: c6d6cbc5d12223741f2d6a703796fffed51db61cfa1dd94fdfb71ed68cbdce12881441d3d4dae7fee7bd85f2ccc408c45b6d427d41862814f2cbab78d49e2daf
7
+ data.tar.gz: 707070691462d95c4245714cd92d959beecb86eee5ff87355a456efbed6b3a4100f06df1ee5eb0a48d83a3178abef76e1f7f4f937856180503f2f2097b06ed61
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # [v0.1.0](https://github.com/Muriel-Salvan/nexus_mods/compare/v0.0.1...v0.1.0) (2023-03-26 17:37:15)
2
+
3
+ ### Patches
4
+
5
+ * [Fix deployment](https://github.com/Muriel-Salvan/nexus_mods/commit/87cef38881b87b08af8c03773bcbda6235f9bbe9)
6
+
7
+ ### Features
8
+
9
+ * [[Feature] Query games, mods and mod files](https://github.com/Muriel-Salvan/nexus_mods/commit/27bba8875a1f70d7256ce18359c02c08c8d78ab7)
10
+
11
+ # 0.0.1
12
+
13
+ * Initial version
data/LICENSE.md ADDED
@@ -0,0 +1,31 @@
1
+
2
+ The license stated herein is a copy of the BSD License (modified on July 1999).
3
+ The AUTHOR mentionned below refers to the list of people involved in the
4
+ creation and modification of any file included in the delivered package.
5
+ This list is found in the file named AUTHORS.
6
+ The AUTHORS and LICENSE files have to be included in any release of software
7
+ embedding source code of this package, or using it as a derivative software.
8
+
9
+ Copyright (c) 2019 - 2023 Muriel Salvan (muriel@x-aeon.com)
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions are met:
13
+
14
+ 1. Redistributions of source code must retain the above copyright notice,
15
+ this list of conditions and the following disclaimer.
16
+ 2. Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+ 3. The name of the author may not be used to endorse or promote products
20
+ derived from this software without specific prior written permission.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25
+ EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27
+ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31
+ OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # nexus_mods
2
+
3
+ Simple Ruby API letting you handle [NexusMods](https://www.nexusmods.com/) REST API.
4
+
5
+ ## Install
6
+
7
+ Via gem
8
+
9
+ ``` bash
10
+ $ gem install nexus_mods
11
+ ```
12
+
13
+ Via a Gemfile
14
+
15
+ ``` ruby
16
+ $ gem 'nexus_mods'
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ``` ruby
22
+ require 'nexus_mods'
23
+
24
+ nexus_mods = NexusMods.new(api_key: 'sdflfkglkjewfmlkvweflkngvkndflvnelrjgn')
25
+ puts nexus_mods.mod(mod_id: 2014).name
26
+ ```
27
+
28
+ ## Change log
29
+
30
+ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
31
+
32
+ ## Testing
33
+
34
+ Automated tests are done using rspec.
35
+
36
+ Do execute them, first install development dependencies:
37
+
38
+ ```bash
39
+ bundle install
40
+ ```
41
+
42
+ Then execute rspec
43
+
44
+ ```bash
45
+ bundle exec rspec
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ Any contribution is welcome:
51
+ * Fork the github project and create pull requests.
52
+ * Report bugs by creating tickets.
53
+ * Suggest improvements and new features by creating tickets.
54
+
55
+ ## Credits
56
+
57
+ - [Muriel Salvan][link-author]
58
+
59
+ ## License
60
+
61
+ The BSD License. Please see [License File](LICENSE.md) for more information.
@@ -0,0 +1,44 @@
1
+ class NexusMods
2
+
3
+ # Object giving the NexusMods API limits
4
+ class ApiLimits
5
+
6
+ attr_reader(
7
+ *%i[
8
+ daily_limit
9
+ daily_remaining
10
+ daily_reset
11
+ hourly_limit
12
+ hourly_remaining
13
+ hourly_reset
14
+ ]
15
+ )
16
+
17
+ # Constructor
18
+ #
19
+ # Parameters::
20
+ # * *daily_limit* (Integer): The daily limit
21
+ # * *daily_remaining* (Integer): The daily remaining
22
+ # * *daily_reset* (Integer): The daily reset time
23
+ # * *hourly_limit* (Integer): The hourly limit
24
+ # * *hourly_remaining* (Integer): The hourly remaining
25
+ # * *hourly_reset* (Integer): The hourly reset time
26
+ def initialize(
27
+ daily_limit:,
28
+ daily_remaining:,
29
+ daily_reset:,
30
+ hourly_limit:,
31
+ hourly_remaining:,
32
+ hourly_reset:
33
+ )
34
+ @daily_limit = daily_limit
35
+ @daily_remaining = daily_remaining
36
+ @daily_reset = daily_reset
37
+ @hourly_limit = hourly_limit
38
+ @hourly_remaining = hourly_remaining
39
+ @hourly_reset = hourly_reset
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,37 @@
1
+ class NexusMods
2
+
3
+ # Categories defined for a game in NexusMods
4
+ class Category
5
+
6
+ attr_reader(
7
+ *%i[
8
+ id
9
+ name
10
+ ]
11
+ )
12
+
13
+ attr_accessor(
14
+ *%i[
15
+ parent_category
16
+ ]
17
+ )
18
+
19
+ # Constructor
20
+ #
21
+ # Parameters::
22
+ # *id* (Integer): The category id
23
+ # *name* (String): The category id
24
+ # *parent_category* (Category or nil): The parent category, or nil if none [default: nil]
25
+ def initialize(
26
+ id:,
27
+ name:,
28
+ parent_category: nil
29
+ )
30
+ @id = id
31
+ @name = name
32
+ @parent_category = parent_category
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,78 @@
1
+ class NexusMods
2
+
3
+ # A NexusMods game.
4
+ # Attributes info can be taken from there:
5
+ # * https://github.com/Nexus-Mods/node-nexus-api/blob/master/docs/interfaces/_types_.igameinfo.md
6
+ class Game
7
+
8
+ attr_reader(
9
+ *%i[
10
+ id
11
+ name
12
+ forum_url
13
+ nexusmods_url
14
+ genre
15
+ domain_name
16
+ approved_date
17
+ files_count
18
+ files_views
19
+ files_endorsements
20
+ downloads_count
21
+ authors_count
22
+ mods_count
23
+ categories
24
+ ]
25
+ )
26
+
27
+ # Constructor
28
+ #
29
+ # Parameters::
30
+ # * *id* (Integer): The game's id
31
+ # * *name* (String): The game's name
32
+ # * *forum_url* (String): The game's forum's URL
33
+ # * *nexusmods_url* (String): The game's NexusMods' URL
34
+ # * *genre* (String): The game's genre
35
+ # * *domain_name* (String): The game's domain's name
36
+ # * *approved_date* (Time): The game's approved date (time when the game was added)
37
+ # * *files_count* (Integer): The game's files' count [default: 0]
38
+ # * *files_views* (Integer): The game's files' views [default: 0]
39
+ # * *files_endorsements* (Integer): The game's files' endorsements [default: 0]
40
+ # * *downloads_count* (Integer): The game's downloads' count [default: 0]
41
+ # * *authors_count* (Integer): The game's authors's count [default: 0]
42
+ # * *mods_count* (Integer): The game's mods' count [default: 0]
43
+ # * *categories* (Array<Category>): The list of game's categories [default: []]
44
+ def initialize(
45
+ id:,
46
+ name:,
47
+ forum_url:,
48
+ nexusmods_url:,
49
+ genre:,
50
+ domain_name:,
51
+ approved_date:,
52
+ files_count: 0,
53
+ files_views: 0,
54
+ files_endorsements: 0,
55
+ downloads_count: 0,
56
+ authors_count: 0,
57
+ mods_count: 0,
58
+ categories: []
59
+ )
60
+ @id = id
61
+ @name = name
62
+ @forum_url = forum_url
63
+ @nexusmods_url = nexusmods_url
64
+ @genre = genre
65
+ @domain_name = domain_name
66
+ @approved_date = approved_date
67
+ @files_count = files_count
68
+ @files_views = files_views
69
+ @files_endorsements = files_endorsements
70
+ @downloads_count = downloads_count
71
+ @authors_count = authors_count
72
+ @mods_count = mods_count
73
+ @categories = categories
74
+ end
75
+
76
+ end
77
+
78
+ end
@@ -0,0 +1,106 @@
1
+ class NexusMods
2
+
3
+ # A NexusMods mod.
4
+ # Attributes info can be taken from there:
5
+ # * https://github.com/Nexus-Mods/node-nexus-api/blob/master/docs/interfaces/_types_.imodinfo.md
6
+ class Mod
7
+
8
+ attr_reader(
9
+ *%i[
10
+ uid
11
+ mod_id
12
+ game_id
13
+ allow_rating
14
+ domain_name
15
+ category_id
16
+ version
17
+ created_time
18
+ updated_time
19
+ author
20
+ contains_adult_content
21
+ status
22
+ available
23
+ uploader
24
+ name
25
+ summary
26
+ description
27
+ picture_url
28
+ downloads_count
29
+ unique_downloads_count
30
+ endorsements_count
31
+ ]
32
+ )
33
+
34
+ # Constructor
35
+ #
36
+ # Parameters::
37
+ # * *uid* (Integer): The mod's uid
38
+ # * *mod_id* (Integer): The mod's id
39
+ # * *game_id* (Integer): The mod's game id
40
+ # * *allow_rating* (Boolean): Does this mod allow endorsements?
41
+ # * *domain_name* (String): The mod's domain name
42
+ # * *category_id* (String): The mod's category id
43
+ # * *version* (String): The mod's version
44
+ # * *created_time* (Time): The mod's creation time
45
+ # * *updated_time* (Time): The mod's update time
46
+ # * *author* (String): The mod's author
47
+ # * *contains_adult_content* (Boolean): Does this mod contain adult content?
48
+ # * *status* (String): The mod's status
49
+ # * *available* (Boolean): Is the mod publicly available?
50
+ # * *uploader* (User): The mod's uploader information
51
+ # * *name* (String or nil): The mod's name, or nil if under moderation [default: nil]
52
+ # * *summary* (String or nil): The mod's summary, or nil if none [default: nil]
53
+ # * *description* (String or nil): The mod's description, or nil if none [default: nil]
54
+ # * *picture_url* (String): The mod's picture_url [default: nil]
55
+ # * *downloads_count* (Integer): The mod's downloads' count [default: 0]
56
+ # * *unique_downloads_count* (Integer): The mod's unique downloads' count [default: 0]
57
+ # * *endorsements_count* (Integer): The mod's endorsements' count [default: 0]
58
+ def initialize(
59
+ uid:,
60
+ mod_id:,
61
+ game_id:,
62
+ allow_rating:,
63
+ domain_name:,
64
+ category_id:,
65
+ version:,
66
+ created_time:,
67
+ updated_time:,
68
+ author:,
69
+ contains_adult_content:,
70
+ status:,
71
+ available:,
72
+ uploader:,
73
+ name: nil,
74
+ summary: nil,
75
+ description: nil,
76
+ picture_url: nil,
77
+ downloads_count: 0,
78
+ unique_downloads_count: 0,
79
+ endorsements_count: 0
80
+ )
81
+ @uid = uid
82
+ @mod_id = mod_id
83
+ @game_id = game_id
84
+ @allow_rating = allow_rating
85
+ @domain_name = domain_name
86
+ @category_id = category_id
87
+ @version = version
88
+ @created_time = created_time
89
+ @updated_time = updated_time
90
+ @author = author
91
+ @contains_adult_content = contains_adult_content
92
+ @status = status
93
+ @available = available
94
+ @uploader = uploader
95
+ @name = name
96
+ @summary = summary
97
+ @description = description
98
+ @picture_url = picture_url
99
+ @downloads_count = downloads_count
100
+ @unique_downloads_count = unique_downloads_count
101
+ @endorsements_count = endorsements_count
102
+ end
103
+
104
+ end
105
+
106
+ end
@@ -0,0 +1,86 @@
1
+ class NexusMods
2
+
3
+ # A NexusMods file.
4
+ # Attributes info can be taken from there:
5
+ # * https://github.com/Nexus-Mods/node-nexus-api/blob/master/docs/interfaces/_types_.ifileinfo.md
6
+ class ModFile
7
+
8
+ attr_reader(
9
+ *%i[
10
+ ids
11
+ uid
12
+ id
13
+ name
14
+ version
15
+ category_id
16
+ category_name
17
+ is_primary
18
+ size
19
+ file_name
20
+ uploaded_time
21
+ mod_version
22
+ external_virus_scan_url
23
+ description
24
+ changelog_html
25
+ content_preview_url
26
+ ]
27
+ )
28
+
29
+ # Constructor
30
+ #
31
+ # Parameters::
32
+ # * *ids* (Array<Integer>): The file's list of IDs
33
+ # * *uid* (Integer): The file's UID
34
+ # * *id* (Integer): The file's main ID
35
+ # * *name* (String): The file's name
36
+ # * *version* (String): The file's version
37
+ # * *category_id* (Symbol): The file's category's ID
38
+ # * *category_name* (String): The file's category_name
39
+ # * *is_primary* (String): Is this file the primary download one?
40
+ # * *size* (Integer): The file's size (in bytes)
41
+ # * *file_name* (String): The file's exact file name
42
+ # * *uploaded_time* (Time): The file's uploaded time
43
+ # * *mod_version* (String): The file's mod version
44
+ # * *external_virus_scan_url* (String): The URL of virus scan for this file
45
+ # * *description* (String): The file's description
46
+ # * *changelog_html* (String): The file's change log in HTML
47
+ # * *content_preview_url* (String): URL to a JSON that gives info on the file's content
48
+ def initialize(
49
+ ids:,
50
+ uid:,
51
+ id:,
52
+ name:,
53
+ version:,
54
+ category_id:,
55
+ category_name:,
56
+ is_primary:,
57
+ size:,
58
+ file_name:,
59
+ uploaded_time:,
60
+ mod_version:,
61
+ external_virus_scan_url:,
62
+ description:,
63
+ changelog_html:,
64
+ content_preview_url:
65
+ )
66
+ @ids = ids
67
+ @uid = uid
68
+ @id = id
69
+ @name = name
70
+ @version = version
71
+ @category_id = category_id
72
+ @category_name = category_name
73
+ @is_primary = is_primary
74
+ @size = size
75
+ @file_name = file_name
76
+ @uploaded_time = uploaded_time
77
+ @mod_version = mod_version
78
+ @external_virus_scan_url = external_virus_scan_url
79
+ @description = description
80
+ @changelog_html = changelog_html
81
+ @content_preview_url = content_preview_url
82
+ end
83
+
84
+ end
85
+
86
+ end
@@ -0,0 +1,37 @@
1
+ class NexusMods
2
+
3
+ # A user on NExusMods.
4
+ # Mainly used for uploaders information.
5
+ class User
6
+
7
+ attr_reader(
8
+ *%i[
9
+ member_id
10
+ member_group_id
11
+ name
12
+ profile_url
13
+ ]
14
+ )
15
+
16
+ # Constructor
17
+ #
18
+ # Parameters::
19
+ # * *member_id* (Integer): The user's member id
20
+ # * *member_group_id* (Integer): The user's member group id
21
+ # * *name* (String): The user's name
22
+ # * *profile_url* (String): The user's profile URL
23
+ def initialize(
24
+ member_id:,
25
+ member_group_id:,
26
+ name:,
27
+ profile_url:
28
+ )
29
+ @member_id = member_id
30
+ @member_group_id = member_group_id
31
+ @name = name
32
+ @profile_url = profile_url
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,5 @@
1
+ class NexusMods
2
+
3
+ VERSION = '0.1.0'
4
+
5
+ end