gw2-api 0.5.0 → 0.7.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 +4 -4
- data/.rubocop.yml +4 -0
- data/Gemfile.lock +13 -1
- data/README.md +7 -0
- data/gw2-api.gemspec +3 -0
- data/lib/gw2/api/version.rb +1 -1
- data/lib/gw2/api.rb +5 -1
- data/lib/gw2/modules/account.rb +102 -0
- data/lib/gw2/modules/character.rb +73 -0
- data/lib/gw2/modules/pvp.rb +23 -0
- data/sig/gw2/api/characters.rbs +37 -0
- data/sig/gw2/api/pvp.rbs +11 -0
- metadata +50 -4
- /data/{LICENSE.txt → LICENSE.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 727a7c4636ce3cf00fee9274cd0e94dbea90cc776285ea67b35e884b5c74a526
|
4
|
+
data.tar.gz: 56956672512cfd2d3b7d8ca2ae63b198f211e4d89988123db0c51adc9889fac5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22563cf0c46a8568a097887681903e7bd1111e7439820f14b7630aec718fb229a1d27a590c424bc0775b5e76caa4114ded4ac1d24dca66adfb5aacc18b276c38
|
7
|
+
data.tar.gz: aeee440d964e4f95e7ed94a6b716e625ce03704161063dcc4a68a75d83f512b645aa90504374e27a0aba2f4539561b6e2c44ad0fb36db7e5e660b6205748db6b
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
NewCops: enable
|
2
3
|
Exclude:
|
3
4
|
- 'gw2-api.gemspec'
|
4
5
|
TargetRubyVersion: 2.6
|
@@ -6,6 +7,9 @@ AllCops:
|
|
6
7
|
Metrics/BlockLength:
|
7
8
|
Enabled: false
|
8
9
|
|
10
|
+
Metrics/ModuleLength:
|
11
|
+
Enabled: false
|
12
|
+
|
9
13
|
Style/StringLiterals:
|
10
14
|
Enabled: true
|
11
15
|
EnforcedStyle: double_quotes
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gw2-api (0.
|
4
|
+
gw2-api (0.7.0)
|
5
|
+
rack (~> 3.0.9.1)
|
5
6
|
rake (~> 13.0)
|
6
7
|
rspec (~> 3.0)
|
7
8
|
rubocop (~> 1.21)
|
9
|
+
simplecov (~> 0.21.2)
|
10
|
+
yard (~> 0.9.36)
|
8
11
|
|
9
12
|
GEM
|
10
13
|
remote: https://rubygems.org/
|
11
14
|
specs:
|
12
15
|
ast (2.4.2)
|
13
16
|
diff-lcs (1.5.1)
|
17
|
+
docile (1.4.0)
|
14
18
|
json (2.7.2)
|
15
19
|
language_server-protocol (3.17.0.3)
|
16
20
|
parallel (1.25.1)
|
@@ -18,6 +22,7 @@ GEM
|
|
18
22
|
ast (~> 2.4.1)
|
19
23
|
racc
|
20
24
|
racc (1.8.0)
|
25
|
+
rack (3.0.9.1)
|
21
26
|
rainbow (3.1.1)
|
22
27
|
rake (13.2.1)
|
23
28
|
regexp_parser (2.9.2)
|
@@ -50,8 +55,15 @@ GEM
|
|
50
55
|
rubocop-ast (1.31.3)
|
51
56
|
parser (>= 3.3.1.0)
|
52
57
|
ruby-progressbar (1.13.0)
|
58
|
+
simplecov (0.21.2)
|
59
|
+
docile (~> 1.1)
|
60
|
+
simplecov-html (~> 0.11)
|
61
|
+
simplecov_json_formatter (~> 0.1)
|
62
|
+
simplecov-html (0.12.3)
|
63
|
+
simplecov_json_formatter (0.1.4)
|
53
64
|
strscan (3.1.0)
|
54
65
|
unicode-display_width (2.5.0)
|
66
|
+
yard (0.9.36)
|
55
67
|
|
56
68
|
PLATFORMS
|
57
69
|
x86_64-linux
|
data/README.md
CHANGED
@@ -31,6 +31,13 @@ A list of available functions can be found `lib/gw2/modules`.
|
|
31
31
|
|
32
32
|
You can find valid parameters for each function in the [Guild Wars 2 API documentation](https://wiki.guildwars2.com/wiki/API:Main) or from the public [API-CDI](https://github.com/arenanet/api-cdi) repo.
|
33
33
|
|
34
|
+
## Docs
|
35
|
+
This project uses [YARD](https://yardoc.org/) for documentation. To generate the documentation, execute:
|
36
|
+
|
37
|
+
$ bundle exec yardoc 'lib/**/*.rb' - README.md LICENSE.md
|
38
|
+
|
39
|
+
The documentation will be generated in the `doc` directory. You can view the documentation by running `yard server` and visiting `http://localhost:8808` in your browser.
|
40
|
+
|
34
41
|
## Tests
|
35
42
|
|
36
43
|
To run the tests, execute:
|
data/gw2-api.gemspec
CHANGED
@@ -31,8 +31,11 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
|
+
spec.add_dependency "rack", "~> 3.0.9.1"
|
34
35
|
spec.add_dependency "rake", "~> 13.0"
|
35
36
|
spec.add_dependency "rspec", "~> 3.0"
|
36
37
|
spec.add_dependency "rubocop", "~> 1.21"
|
38
|
+
spec.add_dependency "simplecov", "~> 0.21.2"
|
39
|
+
spec.add_dependency "yard", "~> 0.9.36"
|
37
40
|
|
38
41
|
end
|
data/lib/gw2/api/version.rb
CHANGED
data/lib/gw2/api.rb
CHANGED
@@ -4,6 +4,8 @@ require_relative "api/version"
|
|
4
4
|
require "net/http"
|
5
5
|
require_relative "modules/achievements"
|
6
6
|
require_relative "modules/account"
|
7
|
+
require_relative "modules/character"
|
8
|
+
require_relative "modules/pvp"
|
7
9
|
|
8
10
|
module Gw2
|
9
11
|
module Api
|
@@ -20,9 +22,11 @@ module Gw2
|
|
20
22
|
class Client
|
21
23
|
include Gw2::Api::Achievements
|
22
24
|
include Gw2::Api::Account
|
25
|
+
include Gw2::Api::Characters
|
26
|
+
include Gw2::Api::Pvp
|
23
27
|
|
24
28
|
def initialize(args)
|
25
|
-
@api_key = args[:api_key] || ENV
|
29
|
+
@api_key = args[:api_key] || ENV.fetch("GW2_API_KEY", nil)
|
26
30
|
@base_url = "https://api.guildwars2.com/v2"
|
27
31
|
end
|
28
32
|
|
data/lib/gw2/modules/account.rb
CHANGED
@@ -29,6 +29,11 @@ module Gw2
|
|
29
29
|
execute_request(request_string)
|
30
30
|
end
|
31
31
|
|
32
|
+
# Returns the account daily crafting
|
33
|
+
def account_daily_crafting
|
34
|
+
execute_request("account/dailycrafting")
|
35
|
+
end
|
36
|
+
|
32
37
|
# Returns the daily dungeons for the account
|
33
38
|
def account_dungeons
|
34
39
|
execute_request("account/dungeons")
|
@@ -71,6 +76,21 @@ module Gw2
|
|
71
76
|
execute_request("account/inventory")
|
72
77
|
end
|
73
78
|
|
79
|
+
# Returns the account jadebot skin id unlocks
|
80
|
+
def account_jadebots
|
81
|
+
execute_request("account/jadebots")
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns the account luck
|
85
|
+
def account_luck
|
86
|
+
execute_request("account/luck")
|
87
|
+
end
|
88
|
+
|
89
|
+
# Returns the account legendary armory unlocks
|
90
|
+
def account_legendary_armory
|
91
|
+
execute_request("account/legendaryarmory")
|
92
|
+
end
|
93
|
+
|
74
94
|
# Returns the mail carrier ids unlocked on the account
|
75
95
|
def account_mail_carriers
|
76
96
|
execute_request("account/mailcarriers")
|
@@ -101,11 +121,41 @@ module Gw2
|
|
101
121
|
execute_request("account/minis")
|
102
122
|
end
|
103
123
|
|
124
|
+
# Alias to account_mounts_skins
|
125
|
+
def account_mount_skins
|
126
|
+
account_mounts_skins
|
127
|
+
end
|
128
|
+
|
129
|
+
# Returns the account mount skins unlocked
|
130
|
+
def account_mounts_skins
|
131
|
+
execute_request("account/mounts/skins")
|
132
|
+
end
|
133
|
+
|
134
|
+
# Alias to account_mounts_types
|
135
|
+
def account_mount_types
|
136
|
+
account_mounts_types
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returns the account mount types unlocked
|
140
|
+
def account_mounts_types
|
141
|
+
execute_request("account/mounts/types")
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns the account novelties unlocked
|
145
|
+
def account_novelties
|
146
|
+
execute_request("account/novelties")
|
147
|
+
end
|
148
|
+
|
104
149
|
# Returns the account outfit ids unlocked
|
105
150
|
def account_outfits
|
106
151
|
execute_request("account/outfits")
|
107
152
|
end
|
108
153
|
|
154
|
+
# Returns the account progression
|
155
|
+
def account_progression
|
156
|
+
execute_request("account/progression")
|
157
|
+
end
|
158
|
+
|
109
159
|
# Returns the account pvp hero ids unlocked
|
110
160
|
def account_pvp_heroes
|
111
161
|
execute_request("account/pvp/heroes")
|
@@ -121,6 +171,11 @@ module Gw2
|
|
121
171
|
execute_request("account/recipes")
|
122
172
|
end
|
123
173
|
|
174
|
+
# Returns the account skiff skin unlocked ids
|
175
|
+
def account_skiffs
|
176
|
+
execute_request("account/skiffs")
|
177
|
+
end
|
178
|
+
|
124
179
|
# Returns the account skin ids unlocked
|
125
180
|
def account_skins
|
126
181
|
execute_request("account/skins")
|
@@ -135,6 +190,53 @@ module Gw2
|
|
135
190
|
def account_wallet
|
136
191
|
execute_request("account/wallet")
|
137
192
|
end
|
193
|
+
|
194
|
+
# Returns the wizard vault daily objectives and progress
|
195
|
+
def account_wizardsvault_daily
|
196
|
+
execute_request("account/wizardsvault/daily")
|
197
|
+
end
|
198
|
+
|
199
|
+
# Returns the astral rewards for the account
|
200
|
+
def account_wizardsvault_listings
|
201
|
+
execute_request("account/wizardsvault/listings")
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returnst he wizard vault weekly objectives and progress
|
205
|
+
def account_wizardsvault_weekly
|
206
|
+
execute_request("account/wizardsvault/weekly")
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the daily world boss clears for the account
|
210
|
+
def account_worldbosses
|
211
|
+
execute_request("account/worldbosses")
|
212
|
+
end
|
213
|
+
|
214
|
+
# Returns the account trading post transactions
|
215
|
+
def commerce_transactions
|
216
|
+
execute_request("commerce/transactions")
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the account characters
|
220
|
+
def account_characters(params = {})
|
221
|
+
execute_with_params("characters", params)
|
222
|
+
end
|
223
|
+
|
224
|
+
# Creates a subtoken of the current api token
|
225
|
+
# @param [Hash] params the options to create the subtoken
|
226
|
+
# Valid Parameters
|
227
|
+
# expires: [String] An ISO-8601 datetime specifing when the generated Subtoken will expire.
|
228
|
+
# The token expiry date may not exceed one year from creation.
|
229
|
+
# Attempting to specify a longer expiry date will result in the expiry being clamped at one year.
|
230
|
+
# permissions: [String] A comma separated list of permissions to grant to the Subtoken.
|
231
|
+
# urls: [String] A comma separated list of URLs that the Subtoken will be restricted to.
|
232
|
+
def create_subtoken(params = {})
|
233
|
+
execute_with_params("createsubtoken", params)
|
234
|
+
end
|
235
|
+
|
236
|
+
# Returns info about the supplied token
|
237
|
+
def token_info(params = {})
|
238
|
+
execute_with_params("tokeninfo", params)
|
239
|
+
end
|
138
240
|
end
|
139
241
|
end
|
140
242
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gw2
|
4
|
+
module Api
|
5
|
+
# achievements.rb
|
6
|
+
module Characters
|
7
|
+
# Returns the account characters
|
8
|
+
def characters(params = {})
|
9
|
+
execute_with_params("characters", params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def character_backstory(character_id, params = {})
|
13
|
+
execute_with_params("characters/#{character_id}/backstory", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def character_buildtabs(character_id, params = {})
|
17
|
+
execute_with_params("characters/#{character_id}/buildtabs", params)
|
18
|
+
end
|
19
|
+
|
20
|
+
def character_core(character_id, params = {})
|
21
|
+
execute_with_params("characters/#{character_id}/core", params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def character_crafting(character_id, params = {})
|
25
|
+
execute_with_params("characters/#{character_id}/crafting", params)
|
26
|
+
end
|
27
|
+
|
28
|
+
def character_equipment(character_id, params = {})
|
29
|
+
execute_with_params("characters/#{character_id}/equipment", params)
|
30
|
+
end
|
31
|
+
|
32
|
+
def character_equipmenttabs(character_id, params = {})
|
33
|
+
execute_with_params("characters/#{character_id}/equipmenttabs", params)
|
34
|
+
end
|
35
|
+
|
36
|
+
def character_inventory(character_id, params = {})
|
37
|
+
execute_with_params("characters/#{character_id}/inventory", params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def character_recipes(character_id, params = {})
|
41
|
+
execute_with_params("characters/#{character_id}/recipes", params)
|
42
|
+
end
|
43
|
+
|
44
|
+
def character_skills(character_id, params = {})
|
45
|
+
execute_with_params("characters/#{character_id}/skills", params)
|
46
|
+
end
|
47
|
+
|
48
|
+
def character_specializations(character_id, params = {})
|
49
|
+
execute_with_params("characters/#{character_id}/specializations", params)
|
50
|
+
end
|
51
|
+
|
52
|
+
def character_active_buildtabs(character_id, params = {})
|
53
|
+
execute_with_params("characters/#{character_id}/buildtabs/active", params)
|
54
|
+
end
|
55
|
+
|
56
|
+
def character_active_equipmenttabs(character_id, params = {})
|
57
|
+
execute_with_params("characters/#{character_id}/equipmenttabs/active", params)
|
58
|
+
end
|
59
|
+
|
60
|
+
def character_hero_points(character_id, params = {})
|
61
|
+
execute_with_params("characters/#{character_id}/heropoints", params)
|
62
|
+
end
|
63
|
+
|
64
|
+
def character_quests(character_id, params = {})
|
65
|
+
execute_with_params("characters/#{character_id}/quests", params)
|
66
|
+
end
|
67
|
+
|
68
|
+
def character_sab(character_id, params = {})
|
69
|
+
execute_with_params("characters/#{character_id}/sab", params)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gw2
|
4
|
+
module Api
|
5
|
+
# achievements.rb
|
6
|
+
module Pvp
|
7
|
+
# Returns the account characters
|
8
|
+
def pvp_stats(params = {})
|
9
|
+
execute_with_params("pvp/stats", params)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Returns detailed info about recent player games
|
13
|
+
def pvp_games(params = {})
|
14
|
+
execute_with_params("pvp/games", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns the best and current standing of a player in sPVP
|
18
|
+
def pvp_standings(params = {})
|
19
|
+
execute_with_params("pvp/standings", params)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Gw2
|
2
|
+
module Api
|
3
|
+
module Characters
|
4
|
+
def character_active_buildtabs: -> Net::HTTP
|
5
|
+
|
6
|
+
def character_active_equipmenttabs: -> Net::HTTP
|
7
|
+
|
8
|
+
def character_backstory: -> Net::HTTP
|
9
|
+
|
10
|
+
def character_buildtabs: -> Net::HTTP
|
11
|
+
|
12
|
+
def character_core: -> Net::HTTP
|
13
|
+
|
14
|
+
def character_crafting: -> Net::HTTP
|
15
|
+
|
16
|
+
def character_equipment: -> Net::HTTP
|
17
|
+
|
18
|
+
def character_equipmenttabs: -> Net::HTTP
|
19
|
+
|
20
|
+
def character_hero_points: -> Net::HTTP
|
21
|
+
|
22
|
+
def character_inventory: -> Net::HTTP
|
23
|
+
|
24
|
+
def character_quests: -> Net::HTTP
|
25
|
+
|
26
|
+
def character_recipes: -> Net::HTTP
|
27
|
+
|
28
|
+
def character_sab: -> Net::HTTP
|
29
|
+
|
30
|
+
def character_skills: -> Net::HTTP
|
31
|
+
|
32
|
+
def character_specializations: -> Net::HTTP
|
33
|
+
|
34
|
+
def characters: -> Net::HTTP
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/sig/gw2/api/pvp.rbs
ADDED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gw2-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Nicholas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.9.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.9.1
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rake
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,34 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '1.21'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.21.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.21.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.9.36
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.9.36
|
55
97
|
description: This is a wrapper to the Guild Wars 2 API. It is designed to make it
|
56
98
|
easier to interact with the API and to provide a more Ruby-like interface to the
|
57
99
|
data provided by the API.
|
@@ -66,7 +108,7 @@ files:
|
|
66
108
|
- CHANGELOG.md
|
67
109
|
- Gemfile
|
68
110
|
- Gemfile.lock
|
69
|
-
- LICENSE.
|
111
|
+
- LICENSE.md
|
70
112
|
- README.md
|
71
113
|
- Rakefile
|
72
114
|
- gw2-api.gemspec
|
@@ -74,10 +116,14 @@ files:
|
|
74
116
|
- lib/gw2/api/version.rb
|
75
117
|
- lib/gw2/modules/account.rb
|
76
118
|
- lib/gw2/modules/achievements.rb
|
119
|
+
- lib/gw2/modules/character.rb
|
120
|
+
- lib/gw2/modules/pvp.rb
|
77
121
|
- sig/gw2/api.rbs
|
78
122
|
- sig/gw2/api/account.rbs
|
79
123
|
- sig/gw2/api/achievements.rbs
|
124
|
+
- sig/gw2/api/characters.rbs
|
80
125
|
- sig/gw2/api/client.rbs
|
126
|
+
- sig/gw2/api/pvp.rbs
|
81
127
|
homepage: https://github.com/nicholasrobertm/gw2-api
|
82
128
|
licenses:
|
83
129
|
- MIT
|
@@ -101,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
147
|
- !ruby/object:Gem::Version
|
102
148
|
version: '0'
|
103
149
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
150
|
+
rubygems_version: 3.5.11
|
105
151
|
signing_key:
|
106
152
|
specification_version: 4
|
107
153
|
summary: This is an API wrapper for the Guild Wars 2 API.
|
/data/{LICENSE.txt → LICENSE.md}
RENAMED
File without changes
|