rbattlenet 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8003293eb4fd70da7ba5d7d56b7abcf775d631af
4
- data.tar.gz: 67f6be0c0acf097957c8f26c64b9206e195785e6
3
+ metadata.gz: 672edf0b68f7ad1b2454b354fd27b3c37c23d31d
4
+ data.tar.gz: 8327e06e65939d323d1029907d0443db31bf0a3d
5
5
  SHA512:
6
- metadata.gz: f34af6db0c0ba2b899c2edcabb6bf71dc0c9dbd82e1eb571e487c473724c3facdbd40314a83bbb44e4e921c04515d96b94d3ea4408df4b842bbd131fae576f1a
7
- data.tar.gz: 609d9866e4b272540b73f5d86bbe74c6f98529123f8188e826d99f35e11f48b890919ff8bd9d22c512ebc20cc2cc63ec2f5e8665eb796cb3fc8b64e4ea232a31
6
+ metadata.gz: 6fdd4a997da1db188b701be7b6a8b7bb378f2fed9350d2cf336d0eb79d48f9d3013d87893b029f478b4fa72c26c75cb0cd7becf5a0beaa927b705a3eded48cc8
7
+ data.tar.gz: dc7fba179d4496987ecafcc118c87fdf5442a251a065cda35564039e19a7c242db46dfa413676c0c708c7fcc668ccdd0b1d034f665ced0cbf7f2a91f9426e974
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # RBattlenet
2
+ [![Code Climate](https://codeclimate.com/github/wingyu/rbattlenet/badges/gpa.svg)](https://codeclimate.com/github/wingyu/rbattlenet)
2
3
 
3
- A Ruby wrapper for the Blizzard's Battle.net Community Platform API.
4
+ A Ruby gem that wraps Blizzard's Battle.net Community Platform API.
4
5
  Currently RBattlenet only covers the World of Warcraft, Diablo 3 and StarCraft 2 APIs
5
6
 
6
7
  ## Installation
@@ -43,42 +44,20 @@ RBattlenet.set_region(region: "eu", locale: "en_GB")
43
44
 
44
45
  ```ruby
45
46
  character = RBattlenet::Wow::Character.find(name: "milhause", realm: "saurfang")
47
+ #character["name"] will give you "Milhause"
46
48
  ```
47
- <a name="overview"></a>
48
- ## Overview
49
+ ## Documentation
49
50
  ### [World of Warcraft](#wow)
50
51
 
51
52
  * [Achievement](#wow-achievement)
52
53
  * [Auction](#wow-auction)
53
54
  * [Battle Pet](#wow-battle-pet)
54
- * [Ability](#wow-battle-pet-ability)
55
- * [Species](#wow-battle-pet-species)
56
- * [Stats](#wow-battle-pet-stats)
57
55
  * [Challenge](#wow-challenge)
58
- * [Realm Leaderboard](#wow-challenge-realm-leaderboard)
59
- * [Region Leaderboard](#wow-challenge-region-leaderboard)
60
56
  * [Character](#wow-character)
61
- * [Profile](#wow-character-profile)
62
- * [Additional Fields](#wow-character-fields)
63
57
  * [Data Resources](#wow-data)
64
- * [Battlegroups](#wow-data-battlegroups)
65
- * [Character Achievements](#wow-data-character-achievements)
66
- * [Character Classes](#wow-data-character-classes)
67
- * [Character Races](#wow-data-character-races)
68
- * [Guild Achievements](#wow-data-guild-achievements)
69
- * [Guild Perks](#wow-data-guild-perks)
70
- * [Guild Rewards](#wow-data-guild-rewards)
71
- * [Item Classes](#wow-data-item-classes)
72
- * [Pet Types](#wow-data-pet-types)
73
- * [Talents](#wow-data-talents)
74
58
  * [Guild](#wow-guild)
75
- * [Profile](#wow-guild-profile)
76
- * [Profile](#wow-guild-fields)
77
59
  * [Item](#wow-item)
78
- * [Item](#wow-item-item)
79
- * [Item Set](#wow-item-item-set)
80
60
  * [PVP](#wow-pvp)
81
- * [Leaderboards](#wow-pvp-leaderboards)
82
61
  * [Quest](#wow-quest)
83
62
  * [Realm Status](#wow-realm-status)
84
63
  * [Recipe](#wow-recipe)
@@ -87,22 +66,13 @@ character = RBattlenet::Wow::Character.find(name: "milhause", realm: "saurfang")
87
66
  ### [Starcraft 2](#sc2)
88
67
 
89
68
  * [Data Resources](#sc2-data)
90
- * [Achievements](#sc2-data-achievements)
91
- * [Rewards](#sc2-data-rewards)
92
69
  * [Ladder](#sc2-ladder)
93
70
  * [Profile](#sc2-profile)
94
- * [Ladders](#sc2-profile-ladders)
95
- * [Match History](#sc2-profile-match-history)
96
71
 
97
72
  ### [Diablo 3](#d3)
98
73
 
99
74
  * [Data Resources](#d3-data)
100
- * [Artisan](#d3-data-artisan)
101
- * [Follower](#d3-data-follower)
102
- * [Item](#d3-data-item)
103
75
  * [Profile](#d3-profile)
104
- * [Career](#d3-profile-career)
105
- * [Hero](#d3-profile-hero)
106
76
 
107
77
  ---
108
78
 
@@ -131,21 +101,18 @@ RBattlenet::Wow::Auction.find(realm: "saurfang")
131
101
  <a name="wow-battle-pet"></a>
132
102
  ### Battle Pet
133
103
 
134
- <a name="wow-battle-pet-ability"></a>
135
104
  #### Abilities
136
105
 
137
106
  ```ruby
138
107
  RBattlenet::Wow::Battlepet.find_abilities(id: 640)
139
108
  ```
140
109
 
141
- <a name="wow-battle-pet-species"></a>
142
110
  #### Species
143
111
 
144
112
  ```ruby
145
113
  RBattlenet::Wow::Battlepet.find_species(species_id: 258)
146
114
  ```
147
115
 
148
- <a name="wow-battle-pet-stats"></a>
149
116
  #### Stats
150
117
 
151
118
  ```ruby
@@ -160,14 +127,12 @@ RBattlenet::Wow::Battlepet.find_stats(species_id: 258,
160
127
  <a name="wow-challenge"></a>
161
128
  ### Challenge
162
129
 
163
- <a name="wow-challenge-realm-leaderboard"></a>
164
130
  #### Realm Leaderboard
165
131
 
166
132
  ```ruby
167
133
  RBattlenet::Wow::Challenge.find_realm(realm: "saurfang")
168
134
  ```
169
135
 
170
- <a name="wow-challenge-region-leaderboard"></a>
171
136
  #### Region Leaderboard
172
137
 
173
138
 
@@ -180,7 +145,6 @@ RBattlenet::Wow::Challenge.find_region
180
145
  <a name="wow-character"></a>
181
146
  ### Character
182
147
 
183
- <a name="wow-character-profile"></a>
184
148
  #### Profile
185
149
 
186
150
 
@@ -188,7 +152,6 @@ RBattlenet::Wow::Challenge.find_region
188
152
  RBattlenet::Wow::Character.find(name: "milhause", realm: "saurfang")
189
153
  ```
190
154
 
191
- <a name="wow-character-fields"></a>
192
155
  #### Additional Fields
193
156
 
194
157
  To see all possible fields visit: [https://dev.battle.net/](https://dev.battle.net)
@@ -199,11 +162,11 @@ RBattlenet::Wow::Character.find(name: "milhause",
199
162
  realm: "saurfang",
200
163
  fields: ["pet slots", "guild"])
201
164
  ```
165
+ ---
202
166
 
203
167
  <a name="wow-data"></a>
204
168
  ### Data Resources
205
169
 
206
- <a name="wow-data-battlegroups"></a>
207
170
  #### Battlegroups
208
171
 
209
172
 
@@ -211,7 +174,6 @@ RBattlenet::Wow::Character.find(name: "milhause",
211
174
  RBattlenet::Wow::DataResources.find_battlegroups
212
175
  ```
213
176
 
214
- <a name="wow-data-character-achievements"></a>
215
177
  #### Character Achievements
216
178
 
217
179
 
@@ -219,7 +181,6 @@ RBattlenet::Wow::DataResources.find_battlegroups
219
181
  RBattlenet::Wow::DataResources.find_character_achievements
220
182
  ```
221
183
 
222
- <a name="wow-data-character-classes"></a>
223
184
  #### Character Classes
224
185
 
225
186
 
@@ -227,7 +188,6 @@ RBattlenet::Wow::DataResources.find_character_achievements
227
188
  RBattlenet::Wow::DataResources.find_character_classes
228
189
  ```
229
190
 
230
- <a name="wow-data-character-races"></a>
231
191
  #### Character Races
232
192
 
233
193
 
@@ -235,7 +195,6 @@ RBattlenet::Wow::DataResources.find_character_classes
235
195
  RBattlenet::Wow::DataResources.find_character_races
236
196
  ```
237
197
 
238
- <a name="wow-data-guild-achievements"></a>
239
198
  #### Guild Achievements
240
199
 
241
200
 
@@ -243,7 +202,6 @@ RBattlenet::Wow::DataResources.find_character_races
243
202
  RBattlenet::Wow::DataResources.find_guild_achievements
244
203
  ```
245
204
 
246
- <a name="wow-data-guild-perks"></a>
247
205
  #### Guild Perks
248
206
 
249
207
 
@@ -259,7 +217,6 @@ RBattlenet::Wow::DataResources.find_guild_perks
259
217
  RBattlenet::Wow::DataResources.find_guild_rewards
260
218
  ```
261
219
 
262
- <a name="wow-data-item-classes"></a>
263
220
  #### Item Classes
264
221
 
265
222
 
@@ -267,7 +224,6 @@ RBattlenet::Wow::DataResources.find_guild_rewards
267
224
  RBattlenet::Wow::DataResources.find_item_classes
268
225
  ```
269
226
 
270
- <a name="wow-data-pet-types"></a>
271
227
  #### Pet Types
272
228
 
273
229
 
@@ -275,7 +231,6 @@ RBattlenet::Wow::DataResources.find_item_classes
275
231
  RBattlenet::Wow::DataResources.find_pet_types
276
232
  ```
277
233
 
278
- <a name="wow-data-talents"></a>
279
234
  #### Talents
280
235
 
281
236
 
@@ -288,14 +243,12 @@ RBattlenet::Wow::DataResources.find_talents
288
243
  <a name="wow-item"></a>
289
244
  ### Item
290
245
 
291
- <a name="wow-item-item"></a>
292
246
  #### Item
293
247
 
294
248
  ```ruby
295
249
  RBattlenet::Wow::Item.find(id: 18803);
296
250
  ```
297
251
 
298
- <a name="wow-item-item-set"></a>
299
252
  #### Item Set
300
253
 
301
254
 
@@ -308,14 +261,12 @@ RBattlenet::Wow::Item.find_set(id: 1060)
308
261
  <a name="wow-guild"></a>
309
262
  ### Guild
310
263
 
311
- <a name="wow-guild-profile"></a>
312
264
  #### Profile
313
265
 
314
266
  ```ruby
315
267
  RBattlenet::Wow::Guild.find(name: "razors edge", realm:"saurfang")
316
268
  ```
317
269
 
318
- <a name="wow-guild-fields"></a>
319
270
  #### Additional data
320
271
 
321
272
 
@@ -330,7 +281,6 @@ RBattlenet::Wow::Guild.find(name: "razors edge",
330
281
  <a name="wow-pvp"></a>
331
282
  ### PVP
332
283
 
333
- <a name="wow-pvp-leaderboards"></a>
334
284
  #### Leaderboards
335
285
 
336
286
  ```ruby
@@ -384,14 +334,12 @@ RBattlenet::Wow::Spell.find(id: 8056)
384
334
  RBattlenet::Sc2::Profile.find(id: 2137104, region: 1, name: 'skt')
385
335
  ```
386
336
 
387
- <a name="sc2-profile-ladders"></a>
388
337
  #### Ladders
389
338
 
390
339
  ```ruby
391
340
  RBattlenet::Sc2::Profile.find_ladders(id: 2137104, region: 1, name: 'skt')
392
341
  ```
393
342
 
394
- <a name="sc2-profile-match-history"></a>
395
343
  #### Match history
396
344
 
397
345
 
@@ -413,7 +361,6 @@ RBattlenet::Sc2::Ladder.find(id: 2200)
413
361
  <a name="sc2-data"></a>
414
362
  ### Data Resources
415
363
 
416
- <a name="sc2-data-achievements"></a>
417
364
  #### Achievements
418
365
 
419
366
 
@@ -421,7 +368,6 @@ RBattlenet::Sc2::Ladder.find(id: 2200)
421
368
  RBattlenet::Sc2::DataResources.find_achievements
422
369
  ```
423
370
 
424
- <a name="sc2-data-rewards"></a>
425
371
  #### Rewards
426
372
 
427
373
 
@@ -437,21 +383,18 @@ RBattlenet::Sc2::DataResources.find_rewards
437
383
  <a name="d3-data"></a>
438
384
  ### Data Resources
439
385
 
440
- <a name="d3-data-artisan"></a>
441
386
  #### Artisan
442
387
 
443
388
  ```ruby
444
389
  RBattlenet::D3::DataResources.find_artisan(artisan: 'blacksmith')
445
390
  ```
446
391
 
447
- <a name="d3-data-follower"></a>
448
392
  #### Follower
449
393
 
450
394
  ```ruby
451
395
  RBattlenet::D3::DataResources.find_follower(follower: 'templar')
452
396
  ```
453
397
 
454
- <a name="d3-data-item"></a>
455
398
  #### Item
456
399
 
457
400
  ```ruby
@@ -465,14 +408,12 @@ RBattlenet::D3::DataResources.find_item(data: data)
465
408
  <a name="d3-profile"></a>
466
409
  ### Profile
467
410
 
468
- <a name="d3-profile-career"></a>
469
411
  #### Career
470
412
 
471
413
  ```ruby
472
414
  RBattlenet::D3::Profile.find_career(battletag: "FaYe-2543")
473
415
  ```
474
416
 
475
- <a name="d3-profile-hero"></a>
476
417
  #### Hero
477
418
 
478
419
  ```ruby
@@ -61,7 +61,7 @@ module RBattlenet
61
61
  #Wrapper for HTTParty requests that injects query parameters
62
62
  def get(uri, queries = @@queries)
63
63
  begin
64
- HTTParty.get(uri + queries)
64
+ HTTParty.get(URI.escape(uri + queries))
65
65
  rescue
66
66
  RBattlenet::Errors::ConnectionError
67
67
  end
@@ -72,10 +72,6 @@ module RBattlenet
72
72
  "https://#{@@region}.api.battle.net/#{path}"
73
73
  end
74
74
 
75
- def parse_spaces(input)
76
- input.gsub(" ", '%20')
77
- end
78
-
79
75
  #Merges required and optional query parameters
80
76
  def merge_queries(queries)
81
77
  @@queries + "#{queries}"
@@ -1,3 +1,3 @@
1
1
  module RBattlenet
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -2,7 +2,6 @@ module RBattlenet
2
2
  module Wow
3
3
  class Challenge
4
4
  def self.find_realm(realm:)
5
- realm = RBattlenet.parse_spaces(realm)
6
5
 
7
6
  uri = RBattlenet.
8
7
  base_uri("#{GAME}/challenge/#{realm}")
@@ -3,7 +3,6 @@ module RBattlenet
3
3
  class Character
4
4
  def self.find(name:, realm:, fields: nil)
5
5
  fields = RBattlenet.parse_fields(fields)
6
- realm = RBattlenet.parse_spaces(realm)
7
6
  queries = RBattlenet.merge_queries(fields)
8
7
 
9
8
  uri = RBattlenet.
@@ -2,9 +2,7 @@ module RBattlenet
2
2
  module Wow
3
3
  class Guild
4
4
  def self.find(name:, realm:, fields: nil)
5
- name = RBattlenet.parse_spaces(name)
6
5
  fields = RBattlenet.parse_fields(fields)
7
- realm = RBattlenet.parse_spaces(realm)
8
6
  queries = RBattlenet.merge_queries(fields)
9
7
 
10
8
  uri = RBattlenet.
@@ -21,7 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "rspec"
24
- spec.add_development_dependency "httparty", "~> 0.13.6"
25
24
  spec.add_development_dependency 'vcr', '~> 2.9.3'
26
25
  spec.add_development_dependency "webmock"
26
+
27
+ spec.add_runtime_dependency "httparty", "~> 0.13.6"
27
28
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbattlenet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Wong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-29 00:00:00.000000000 Z
11
+ date: 2016-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: httparty
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.13.6
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.13.6
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: vcr
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +80,20 @@ dependencies:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: httparty
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.13.6
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.13.6
97
97
  description: My attempt at creating a Ruby wrapper for the Blizzard's Battle.net Community
98
98
  Platform API.
99
99
  email:
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  version: '0'
218
218
  requirements: []
219
219
  rubyforge_project:
220
- rubygems_version: 2.4.3
220
+ rubygems_version: 2.4.6
221
221
  signing_key:
222
222
  specification_version: 4
223
223
  summary: A wrapper for the Blizzard's Battle.net API