restiny 6.1.0 → 7.0.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: b13f8972845550ae0ddda6b09d4167188a4cbdebf3951adb88b16d69554d0644
4
- data.tar.gz: b57fd5b6295147321ae1aa839007f738b87a99ba6c3682428ebefeb49dc9de09
3
+ metadata.gz: 94b86ac8eef6e043f969c308d972aa270a5ff62729ae8a2a014e9d42eddb6abd
4
+ data.tar.gz: 89215a12fe34c1ac384138e4deb082bc89ac44aeb2674aa6cace2baa83d60b47
5
5
  SHA512:
6
- metadata.gz: a13e9f6421db33ae7e2fdfef2cb84a175786fa64a32a502ad93096c2b4eff041aa5f8c7255a96df4972c1e168042d274409245560ac40d67f1c3517755416ab7
7
- data.tar.gz: 786f519aa8b81589758c64e7552fa13183b45e45e6ea56986dbad6b4d1bf2282be2067de6f1cd03a24a60100bf25f2f67801355b50c28f209b58926d1a3eb2a9
6
+ metadata.gz: 8ba595525a8876dd96ca69e4808302077331ce91ac399bbe0a510653c669e09eff24f45033fe86c946ce1f4c9b29752b753b62b1fe90623de3a04cf4e7a119e7
7
+ data.tar.gz: 0a53e35f431eb23db57462ecf50efda74305289cd83490e48bd701f5a209ae89a02cee751fa9747ec9a086bf471b60b9642aa8487d6787b6d911b901e0b50d46
@@ -12,6 +12,8 @@ module Restiny
12
12
 
13
13
  module Api
14
14
  module Base
15
+ private
16
+
15
17
  def get(endpoint)
16
18
  make_api_request(endpoint, method: :get)
17
19
  end
@@ -20,18 +22,23 @@ module Restiny
20
22
  make_api_request(endpoint, method: :post, params: params)
21
23
  end
22
24
 
23
- private
24
-
25
25
  def http_client
26
- HTTPX.with(origin: BUNGIE_URL, headers: api_headers).plugin(:follow_redirects, follow_insecure_redirects: true)
26
+ HTTPX.with(
27
+ origin: BUNGIE_URL,
28
+ headers: api_headers,
29
+ base_path: '/platform/'
30
+ ).plugin(
31
+ :follow_redirects,
32
+ follow_insecure_redirects: true
33
+ )
27
34
  end
28
35
 
29
36
  def make_api_request(endpoint, method: :get, params: {})
30
37
  raise Restiny::InvalidParamsError, 'You need to set an API key (Restiny.api_key)' if @api_key.nil?
31
38
 
32
- response = http_client.with(base_path: '/platform/').request(method, endpoint, json: params)
33
- response.raise_for_status
39
+ response = http_client.request(method, endpoint, json: params)
34
40
 
41
+ response.raise_for_status
35
42
  response.json['Response']
36
43
  rescue HTTPX::TimeoutError, HTTPX::ResolveError => e
37
44
  raise Restiny::RequestError, e.message
@@ -26,6 +26,7 @@ module Restiny
26
26
 
27
27
  {}.tap do |files|
28
28
  definitions.each do |definition|
29
+ next unless paths.key?(definition)
29
30
  files[definition] = download_manifest_json_by_url(BUNGIE_URL + paths[definition])
30
31
  end
31
32
  end
@@ -9,7 +9,7 @@ module Restiny
9
9
  STEAM = 3
10
10
  EPIC = 6
11
11
 
12
- def self.names
12
+ def self.all
13
13
  {
14
14
  ALL => 'All',
15
15
  XBOX => 'Xbox',
@@ -20,17 +20,15 @@ module Restiny
20
20
  end
21
21
  end
22
22
 
23
+ # Definitions for the possible locations an item can be related to a character.
23
24
  module ItemLocation
24
- # Definitions for the possible locations an item can be related to a character.
25
- UNKNOWN = 0
26
25
  INVENTORY = 1
27
26
  VAULT = 2
28
27
  VENDOR = 3
29
28
  POSTMASTER = 4
30
29
 
31
- def self.names
30
+ def self.all
32
31
  {
33
- UNKNOWN => 'Unknown',
34
32
  INVENTORY => 'Inventory',
35
33
  VAULT => 'Vault',
36
34
  VENDOR => 'Vendor',
@@ -41,7 +39,6 @@ module Restiny
41
39
 
42
40
  # Definitions for the tier/rarity of a particular item.
43
41
  module TierType
44
- UNKNOWN = 0
45
42
  CURRENCY = 1
46
43
  BASIC = 2
47
44
  COMMON = 3
@@ -49,9 +46,8 @@ module Restiny
49
46
  LEGENDARY = 5
50
47
  EXOTIC = 6
51
48
 
52
- def self.names
49
+ def self.all
53
50
  {
54
- UNKNOWN => 'Unknown',
55
51
  CURRENCY => 'Currency',
56
52
  BASIC => 'Basic',
57
53
  COMMON => 'Common',
@@ -67,14 +63,14 @@ module Restiny
67
63
  TITAN = 0
68
64
  HUNTER = 1
69
65
  WARLOCK = 2
70
- UNKNOWN = 3
66
+ ANY = 3
71
67
 
72
- def self.names
68
+ def self.all
73
69
  {
74
70
  TITAN => 'Titan',
75
71
  HUNTER => 'Hunter',
76
72
  WARLOCK => 'Warlock',
77
- UNKNOWN => 'Unknown'
73
+ ANY => 'Any'
78
74
  }
79
75
  end
80
76
  end
@@ -84,14 +80,12 @@ module Restiny
84
80
  HUMAN = 0
85
81
  AWOKEN = 1
86
82
  EXO = 2
87
- UNKNOWN = 3
88
83
 
89
- def self.names
84
+ def self.all
90
85
  {
91
86
  HUMAN => 'Human',
92
87
  AWOKEN => 'Awoken',
93
- EXO => 'Exo',
94
- UNKNOWN => 'Unknown'
88
+ EXO => 'Exo'
95
89
  }
96
90
  end
97
91
  end
@@ -100,55 +94,47 @@ module Restiny
100
94
  module Gender
101
95
  MASCULINE = 0
102
96
  FEMININE = 1
103
- UNKNOWN = 2
104
97
 
105
- def self.names
98
+ def self.all
106
99
  {
107
100
  MASCULINE => 'Masculine',
108
- FEMININE => 'Feminine',
109
- UNKNOWN => 'Unknown'
101
+ FEMININE => 'Feminine'
110
102
  }
111
103
  end
112
104
  end
113
105
 
114
106
  # Definitions for the Champion breaker types used in the game.
115
- module Breaker
116
- NONE = 0
107
+ module BreakerType
117
108
  SHIELD_PIERCING = 1
118
109
  DISRUPTION = 2
119
110
  STAGGER = 3
120
111
 
121
- def self.names
112
+ def self.all
122
113
  {
123
- NONE: 'None',
124
- SHIELD_PIERCING: 'Shield-Piercing',
125
- DISRUPTION: 'Disruption',
126
- STAGGER: 'Stagger'
114
+ SHIELD_PIERCING => 'Shield-Piercing',
115
+ DISRUPTION => 'Disruption',
116
+ STAGGER => 'Stagger'
127
117
  }
128
118
  end
129
119
  end
130
120
 
131
121
  # Definitions for the various types of ammunition used in the game.
132
122
  module Ammunition
133
- NONE = 0
134
123
  PRIMARY = 1
135
124
  SPECIAL = 2
136
125
  HEAVY = 3
137
- UNKNOWN = 4
138
126
 
139
- def self.names
127
+ def self.all
140
128
  {
141
- NONE => 'None',
142
129
  PRIMARY => 'Primary',
143
130
  SPECIAL => 'Special',
144
- HEAVY => 'Heavy',
145
- UNKNOWN => 'Unknown'
131
+ HEAVY => 'Heavy'
146
132
  }
147
133
  end
148
134
  end
149
135
 
136
+ # Definitions for the various damage types in the game.
150
137
  module DamageType
151
- NONE = 0
152
138
  KINETIC = 1
153
139
  ARC = 2
154
140
  SOLAR = 3
@@ -157,9 +143,8 @@ module Restiny
157
143
  STASIS = 6
158
144
  STRAND = 7
159
145
 
160
- def self.names
146
+ def self.all
161
147
  {
162
- NONE => 'None',
163
148
  KINETIC => 'Kinetic',
164
149
  ARC => 'Arc',
165
150
  SOLAR => 'Solar',
@@ -171,6 +156,182 @@ module Restiny
171
156
  end
172
157
  end
173
158
 
159
+ # Definitions for the slots a weapon can be placed in.
160
+ module WeaponSlot
161
+ KINETIC_SLOT = 1
162
+ ENERGY_SLOT = 2
163
+ POWER_SLOT = 3
164
+
165
+ def self.all
166
+ {
167
+ KINETIC_SLOT => 'Kinetic',
168
+ ENERGY_SLOT => 'Energy',
169
+ POWER_SLOT => 'Power'
170
+ }
171
+ end
172
+ end
173
+
174
+ # Definitions for the various gear-related groups within Destiny 2.
175
+ module Faction
176
+ CRUCIBLE = 1
177
+ DEAD_ORBIT = 2
178
+ FUTURE_WAR_CULT = 3
179
+ NEW_MONARCHY = 4
180
+ VANGUARD = 5
181
+
182
+ def self.all
183
+ {
184
+ CRUCIBLE => 'Crucible',
185
+ DEAD_ORBIT => 'Dead Orbit',
186
+ FUTURE_WAR_CULT => 'Future War Cult',
187
+ NEW_MONARCHY => 'New Monarchy',
188
+ VANGUARD => 'Vanguard'
189
+ }
190
+ end
191
+
192
+ def self.mapping
193
+ {
194
+ 'faction.crucible' => CRUCIBLE,
195
+ 'faction.dead_orbit' => DEAD_ORBIT,
196
+ 'faction.future_war_cult' => FUTURE_WAR_CULT,
197
+ 'faction.new_monarchy' => NEW_MONARCHY,
198
+ 'faction.vanguard' => VANGUARD
199
+ }
200
+ end
201
+ end
202
+
203
+ # Definitions for the weapon manufacturers in Destiny 2.
204
+ module Foundry
205
+ DAITO = 1
206
+ FIELD_FORGED = 2
207
+ FOTC = 3
208
+ HAKKE = 4
209
+ OMOLON = 5
210
+ SUROS = 6
211
+ TEX_MECHANICA = 7
212
+ VEIST = 8
213
+
214
+ def self.all
215
+ {
216
+ DAITO => 'Daito',
217
+ FIELD_FORGED => 'Field Forged',
218
+ FOTC => 'Forces of the City',
219
+ HAKKE => 'Häkke',
220
+ OMOLON => 'Omolon',
221
+ SUROS => 'SUROS',
222
+ TEX_MECHANICA => 'Tex Mechanica',
223
+ VEIST => 'VEIST'
224
+ }
225
+ end
226
+
227
+ def self.mapping
228
+ {
229
+ 'foundry.daito' => DAITO,
230
+ 'foundry.field_forged' => FIELD_FORGED,
231
+ 'foundry.fotc' => FOTC,
232
+ 'foundry.hakke' => HAKKE,
233
+ 'foundry.omolon' => OMOLON,
234
+ 'foundry.suros' => SUROS,
235
+ 'foundry.tex_mechanica' => TEX_MECHANICA,
236
+ 'foundry.veist' => VEIST
237
+ }
238
+ end
239
+ end
240
+
241
+ # Definitions for the various types of armour in the game.
242
+ module Armor
243
+ ARMS = 1
244
+ CHEST = 2
245
+ CLASS = 3
246
+ HEAD = 4
247
+ LEGS = 5
248
+
249
+ def self.all
250
+ {
251
+ ARMS => 'Gauntlet',
252
+ CHEST => 'Chest',
253
+ CLASS => 'Class Item',
254
+ HEAD => 'Helmet',
255
+ LEGS => 'Leg'
256
+ }
257
+ end
258
+
259
+ def self.mapping
260
+ {
261
+ 'item.armor.arms' => ARMS,
262
+ 'item.armor.chest' => CHEST,
263
+ 'item.armor.class' => CLASS,
264
+ 'item.armor.head' => HEAD,
265
+ 'item.armor.legs' => LEGS
266
+ }
267
+ end
268
+ end
269
+
270
+ # Definitions for the various types of weapons in the game.
271
+ module Weapon
272
+ AUTO_RIFLE = 1
273
+ BOW = 2
274
+ FUSION_RIFLE = 3
275
+ GLAIVE = 4
276
+ GRENADE_LAUNCHER = 5
277
+ HAND_CANNON = 6
278
+ LINEAR_FUSION_RIFLE = 7
279
+ MACHINE_GUN = 8
280
+ PULSE_RIFLE = 9
281
+ ROCKET_LAUNCHER = 10
282
+ SCOUT_RIFLE = 11
283
+ SHOTGUN = 12
284
+ SIDEARM = 13
285
+ SNIPER_RIFLE = 14
286
+ SUBMACHINE_GUN = 15
287
+ SWORD = 16
288
+ TRACE_RIFLE = 17
289
+
290
+ def self.all
291
+ {
292
+ AUTO_RIFLE => 'Auto Rifle',
293
+ BOW => 'Bow',
294
+ FUSION_RIFLE => 'Fusion Rifle',
295
+ GLAIVE => 'Glaive',
296
+ GRENADE_LAUNCHER => 'Grenade Launcher',
297
+ HAND_CANNON => 'Hand Cannon',
298
+ LINEAR_FUSION_RIFLE => 'Linear Fusion Rifle',
299
+ MACHINE_GUN => 'Machine Gun',
300
+ PULSE_RIFLE => 'Pulse Rifle',
301
+ ROCKET_LAUNCHER => 'Rocket Launcher',
302
+ SCOUT_RIFLE => 'Scout Rifle',
303
+ SHOTGUN => 'Shotgun',
304
+ SIDEARM => 'Sidearm',
305
+ SNIPER_RIFLE => 'Sniper Rifle',
306
+ SUBMACHINE_GUN => 'Submachine Gun',
307
+ SWORD => 'Sword',
308
+ TRACE_RIFLE => 'Trace Rifle'
309
+ }
310
+ end
311
+
312
+ def self.mapping
313
+ {
314
+ 'item.weapon.auto_rifle' => AUTO_RIFLE,
315
+ 'item.weapon.bow' => BOW,
316
+ 'item.weapon.fusion_rifle' => FUSION_RIFLE,
317
+ 'item.weapon.glaive' => GLAIVE,
318
+ 'item.weapon.grenade_launcher' => GRENADE_LAUNCHER,
319
+ 'item.weapon.hand_cannon' => HAND_CANNON,
320
+ 'item.weapon.linear_fusion_rifle' => LINEAR_FUSION_RIFLE,
321
+ 'item.weapon.machinegun' => MACHINE_GUN,
322
+ 'item.weapon.pulse_rifle' => PULSE_RIFLE,
323
+ 'item.weapon.rocket_launcher' => ROCKET_LAUNCHER,
324
+ 'item.weapon.scout_rifle' => SCOUT_RIFLE,
325
+ 'item.weapon.shotgun' => SHOTGUN,
326
+ 'item.weapon.sidearm' => SIDEARM,
327
+ 'item.weapon.sniper_rifle' => SNIPER_RIFLE,
328
+ 'item.weapon.submachinegun' => SUBMACHINE_GUN,
329
+ 'item.weapon.sword' => SWORD,
330
+ 'item.weapon.trace_rifle' => TRACE_RIFLE
331
+ }
332
+ end
333
+ end
334
+
174
335
  # Definitions for the various component types used when requesting a profile entry.
175
336
  module ComponentType
176
337
  PROFILES = '100'
@@ -212,6 +373,24 @@ module Restiny
212
373
  SOCIAL_COMMENDATIONS = '1400'
213
374
  end
214
375
 
376
+ # The source location of a socket plug.
377
+ module SocketPlugSource
378
+ NONE = 0
379
+ INVENTORY_SOURCED = 1
380
+ REUSABLE_PLUG_ITEMS = 2
381
+ PROFILE_PLUG_SET = 4
382
+ CHARACTER_PLUG_SET = 8
383
+
384
+ def self.sources_for_value(value)
385
+ [].tap do |sources|
386
+ constants.each do |source|
387
+ source_value = const_get(source)
388
+ sources << source_value if (value & source_value) != 0
389
+ end
390
+ end
391
+ end
392
+ end
393
+
215
394
  # The categories of data stored in the manifest.
216
395
  module ManifestDefinition
217
396
  def self.values
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Restiny
4
4
  class Error < StandardError; end
5
+
5
6
  class NetworkError < Error; end
6
7
  class RequestError < Error; end
7
8
  class InvalidParamsError < RequestError; end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Restiny
4
- VERSION = '6.1.0'
4
+ VERSION = '7.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restiny
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 7.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-24 00:00:00.000000000 Z
11
+ date: 2025-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpx
@@ -47,7 +47,7 @@ licenses:
47
47
  - MIT
48
48
  metadata:
49
49
  rubygems_mfa_required: 'true'
50
- post_install_message:
50
+ post_install_message:
51
51
  rdoc_options: []
52
52
  require_paths:
53
53
  - lib
@@ -55,15 +55,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - ">"
57
57
  - !ruby/object:Gem::Version
58
- version: '3.0'
58
+ version: '3.3'
59
59
  required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubygems_version: 3.2.33
66
- signing_key:
65
+ rubygems_version: 3.5.11
66
+ signing_key:
67
67
  specification_version: 4
68
68
  summary: A Destiny API gem
69
69
  test_files: []