bnet_api 0.1.5 → 1.0.2

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NjEwNzFmMzlkNTRhZDAwMzYwMjU3MTI4NmNlYmM2OTg2YTBmMDAyZg==
5
- data.tar.gz: !binary |-
6
- Njg1Y2JiNmJmMmU2ODk5ZjNkZmZjYmVkODk1ZGI5MzM3MzljNGJjZg==
2
+ SHA1:
3
+ metadata.gz: dce6fc4f722c71738fe977fc830d67a77534995b
4
+ data.tar.gz: 21ee936c8e7595326a34b1c8fdbe934e2a031a73
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- Y2VhNzgzZDcyODk3YWY2NGRhNDQ4ZDBkNmI4MTg5MjYyNTE2MGJmZWFmN2Uw
10
- OGY0OTdkN2Y0NjkwZmI4ZmJjNjgzMTg3ZTBjMzIxZDZmMGY3OGY5NDZhZmE1
11
- OWRmZmQ4MjhiNDI5MTYzOTAxMmUxNDA5NzRjNWFkMjJjYmJiNjI=
12
- data.tar.gz: !binary |-
13
- Y2IzYTM4MjRjYjM0MmM2ODlkMWM5M2ZhNWI4NmY0YzE5NjM4OTU3Mjc0NzY0
14
- ZGJmMjFjMGM2ODBkZjU5ZjM4NDI4NzhhMTY5MDk4NjI2MTViZjhmYmZkN2Qw
15
- Y2VmMjY0MmQ2Y2EwY2U3NzczZWEyYjgzYjUxYjczMDU4ODY4Nzc=
6
+ metadata.gz: 3d8b900eecc6e9cc6521930fecd0f74d02bbdf6fe22430d52060d4ed5421eb3243892b5886761ceeac9144f893574541d6b45cd18c0076b5f8164fa7755a3640
7
+ data.tar.gz: 28ded9244f9c293c406af90d696797c3ee8c322147b7bc34567644a20e4af88586186e1c2f68282a777b301746e45e1b94411fc4a5b2d571c18e74eeefa6ddca
data/.travis.yml CHANGED
@@ -1,10 +1,8 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 1.9.3
5
4
  - 2.0.0
6
5
  - 2.1
7
- - jruby-19mode
8
6
  - jruby-head
9
7
  - rbx-2
10
8
  - ruby-head
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 1.0.2
2
+
3
+ * Removed development dependencies from gemspec
4
+
5
+ # 1.0.1
6
+
7
+ * Added required ruby version to gemspec
8
+
9
+ # 1.0.0
10
+
11
+ * Require Ruby >= 2.0.0
12
+ * Updated old WoW Battlepet APIs to use new Pet APIs
13
+
1
14
  # 0.1.4
2
15
 
3
16
  * Added Starcraft II APIs
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gem 'rake'
5
5
  group :test do
6
6
  gem 'coveralls'
7
7
  gem 'simplecov'
8
- gem 'rspec', '>= 2.14'
8
+ gem 'rspec', '>= 3.5'
9
9
  end
10
10
 
11
11
  gemspec
data/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014 Tom Connolly
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Tom Connolly
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
data/README.md CHANGED
@@ -12,6 +12,10 @@ A Ruby wrapper for the Battle.net API.
12
12
 
13
13
  gem install bnet_api
14
14
 
15
+ ## Requirements
16
+
17
+ * Ruby 2.0.0 or higher
18
+
15
19
  ## Configuration
16
20
 
17
21
  You need to set at least the Battle.net API key in the configuration, either in the code or in an initializer.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require 'rspec/core/rake_task'
2
- RSpec::Core::RakeTask.new(:spec)
3
-
4
- task test: :spec
5
-
1
+ require 'rspec/core/rake_task'
2
+ RSpec::Core::RakeTask.new(:spec)
3
+
4
+ task test: :spec
5
+
6
6
  task default: [:spec]
data/bnet_api.gemspec CHANGED
@@ -1,25 +1,24 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'bnet_api/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "bnet_api"
8
- spec.version = BnetApi::VERSION
9
- spec.authors = ["Tom Connolly"]
10
- spec.email = ["tconnolly1991@gmail.com"]
11
- spec.summary = %q{Ruby wrapper for the Battle.net web API.}
12
- spec.description = %q{Ruby wrapper for the Battle.net web API. For more info visit https://dev.battle.net}
13
- spec.homepage = "https://github.com/tconnolly/bnetapi"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_dependency 'httparty', '0.13.3'
22
-
23
- spec.add_development_dependency 'bundler'
24
- spec.add_development_dependency 'rspec'
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bnet_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bnet_api"
8
+ spec.version = BnetApi::VERSION
9
+ spec.authors = ["Tom Connolly"]
10
+ spec.email = ["tconnolly1991@gmail.com"]
11
+ spec.summary = %q{Ruby wrapper for the Battle.net web API.}
12
+ spec.description = %q{Ruby wrapper for the Battle.net web API. For more info visit https://dev.battle.net}
13
+ spec.homepage = "https://github.com/tconnolly/bnetapi"
14
+ spec.license = "MIT"
15
+
16
+ spec.required_ruby_version = '>= 2.0.0'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency 'httparty', '0.14.0'
25
24
  end
@@ -1,3 +1,3 @@
1
1
  module BnetApi
2
- VERSION = '0.1.5'
2
+ VERSION = '1.0.2'
3
3
  end
data/lib/bnet_api/wow.rb CHANGED
@@ -21,43 +21,6 @@ module BnetApi
21
21
  BnetApi.make_request("/wow/auction/data/#{realm}")
22
22
  end
23
23
 
24
- # Retrieves the battlepet ability with the specified ID.
25
- #
26
- # @param id [Integer] The ID of the ability.
27
- # @return [Hash] A hash containing the ability data.
28
- def battlepet_ability(id)
29
- BnetApi.make_request("/wow/battlePet/ability/#{id}")
30
- end
31
-
32
- # Retrieves the battlepet species with the specified ID.
33
- #
34
- # @param id [Integer] The ID of the species.
35
- # @return [Hash] A hash containing the species data.
36
- def battlepet_species(id)
37
- BnetApi.make_request("/wow/battlePet/species/#{id}")
38
- end
39
-
40
- # Retrieves the stats for the battlepet with the specified ID.
41
- #
42
- # @param species_id [Integer] The ID of the battlepet species.
43
- # @param options [Hash] Any additional options.
44
- # @option options [Integer] :level The level of the species.
45
- # @option options [Integer] :breedId The ID of the breed.
46
- # @option options [Integer] :qualityId The quality of the battlepet.
47
- # @return [Hash] A hash containing the battlepet stats data.
48
- def battlepet_stats(species_id, options = {})
49
- level = options[:level] || 1
50
- breedId = options[:breedId] || 3
51
- qualityId = options[:qualityId] || 1
52
-
53
- BnetApi.make_request_with_params("/wow/battlePet/stats/#{species_id}",
54
- {
55
- level: level,
56
- breedId: breedId,
57
- qualityId: qualityId }
58
- )
59
- end
60
-
61
24
  # Retrieves the challenge mode leaderboard for the specified realm.
62
25
  #
63
26
  # @param realm [String] The realm to retrieve the leaderboard for.
@@ -114,6 +77,50 @@ module BnetApi
114
77
  end
115
78
  BnetApi.make_request("/wow/guild/#{URI.escape(realm)}/#{URI.escape(name)}", optional_fields)
116
79
  end
80
+
81
+ # Retrieves a list of all battle and vanity pets.
82
+ #
83
+ # @return [Hash] A hash containing a list of pets.
84
+ def pet_master_list
85
+ BnetApi.make_request("/wow/pet/")
86
+ end
87
+
88
+ # Retrieves the pet ability with the specified ID.
89
+ #
90
+ # @param id [Integer] The ID of the ability.
91
+ # @return [Hash] A hash containing the ability data.
92
+ def pet_ability(id)
93
+ BnetApi.make_request("/wow/pet/ability/#{id}")
94
+ end
95
+
96
+ # Retrieves the pet species with the specified ID.
97
+ #
98
+ # @param id [Integer] The ID of the species.
99
+ # @return [Hash] A hash containing the species data.
100
+ def pet_species(id)
101
+ BnetApi.make_request("/wow/pet/species/#{id}")
102
+ end
103
+
104
+ # Retrieves the stats for the pet with the specified ID.
105
+ #
106
+ # @param species_id [Integer] The ID of the pet species.
107
+ # @param options [Hash] Any additional options.
108
+ # @option options [Integer] :level The level of the species.
109
+ # @option options [Integer] :breedId The ID of the breed.
110
+ # @option options [Integer] :qualityId The quality of the pet.
111
+ # @return [Hash] A hash containing the pet stats data.
112
+ def pet_stats(species_id, options = {})
113
+ level = options[:level] || 1
114
+ breedId = options[:breedId] || 3
115
+ qualityId = options[:qualityId] || 1
116
+
117
+ BnetApi.make_request_with_params("/wow/pet/stats/#{species_id}",
118
+ {
119
+ level: level,
120
+ breedId: breedId,
121
+ qualityId: qualityId }
122
+ )
123
+ end
117
124
 
118
125
  # Retrieves the PvP leaderboard for the specified bracket.
119
126
  #
@@ -1,18 +1,18 @@
1
- require 'spec_helper'
2
-
3
- describe BnetApi do
4
-
5
- before :each do
6
- BnetApi.configure do |config|
7
- config.api_key = ENV['BNET_API_KEY']
8
- config.api_secret = ENV['BNET_API_SECRET']
9
- end
10
- end
11
-
12
- it "sets up the configuration" do
13
- expect(BnetApi.config.region).to eq(:eu)
14
- expect(BnetApi.config.locale).to eq(:en_GB)
15
- expect(BnetApi.config.api_key).to eq(ENV['BNET_API_KEY'])
16
- expect(BnetApi.config.api_secret).to eq(ENV['BNET_API_SECRET'])
17
- end
1
+ require 'spec_helper'
2
+
3
+ describe BnetApi do
4
+
5
+ before :each do
6
+ BnetApi.configure do |config|
7
+ config.api_key = ENV['BNET_API_KEY']
8
+ config.api_secret = ENV['BNET_API_SECRET']
9
+ end
10
+ end
11
+
12
+ it "sets up the configuration" do
13
+ expect(BnetApi.config.region).to eq(:eu)
14
+ expect(BnetApi.config.locale).to eq(:en_GB)
15
+ expect(BnetApi.config.api_key).to eq(ENV['BNET_API_KEY'])
16
+ expect(BnetApi.config.api_secret).to eq(ENV['BNET_API_SECRET'])
17
+ end
18
18
  end
@@ -1,92 +1,92 @@
1
- require 'spec_helper'
2
-
3
- describe BnetApi::D3 do
4
-
5
- before :each do
6
- BnetApi.configure do |config|
7
- config.api_key = ENV['BNET_API_KEY']
8
- config.api_secret = ENV['BNET_API_SECRET']
9
- end
10
- end
11
-
12
- it "gets a career profile from the API" do
13
- profile = BnetApi::D3.career_profile('Ragwolf#2851')
14
-
15
- expect(profile['battleTag']).to eq 'Ragwolf#2851'
16
- expect(profile['heroes']).not_to be_nil
17
- end
18
-
19
- it "gets a hero profile from the API" do
20
- profile = BnetApi::D3.hero_profile('Ragwolf#2851', 47516365)
21
-
22
- expect(profile['name']).to eq 'Ragwolf'
23
- expect(profile['class']).to eq 'demon-hunter'
24
- expect(profile['skills']).not_to be_nil
25
- end
26
-
27
- it "gets the data for an item from the API" do
28
- item = BnetApi::D3.item_data('Co4BCJbokeUHEgcIBBV_-U5dHcj6vKAdjs3dnR2dB5UkHSCd5AQd6XAvux3DDZzlIgsIARW1RAMAGAogJjCLAjjqA0AASBNQEFgEYOwEaisKDAgAEMPSgK2BgIDAEhIbCJ7JnZUJEgcIBBUVn9irMIsCOABAAVgEkAEBpQEgneQErQFmIwZQuAHSiJmSBcABBhj-5ffUC1AAWAI')
29
-
30
- expect(item['id']).to eq 'Helm_208'
31
- expect(item['name']).to eq 'Prime Shelter'
32
- expect(item['icon']).to eq 'helm_208_demonhunter_male'
33
- expect(item['displayColor']).to eq 'yellow'
34
- end
35
-
36
- it "gets the data for the templar follower from the API" do
37
- follower = BnetApi::D3.follower_data('templar')
38
-
39
- expect(follower['slug']).to eq 'templar'
40
- expect(follower['name']).to eq 'Templar'
41
- expect(follower['realName']).to eq 'd3.follower.templar.realName'
42
- expect(follower['portrait']).to eq 'templar'
43
- expect(follower['skills']).not_to be_nil
44
- end
45
-
46
- it "gets the data for the enchantress follower from the API" do
47
- follower = BnetApi::D3.follower_data('enchantress')
48
-
49
- expect(follower['slug']).to eq 'enchantress'
50
- expect(follower['name']).to eq 'Enchantress'
51
- expect(follower['realName']).to eq 'd3.follower.enchantress.realName'
52
- expect(follower['portrait']).to eq 'enchantress'
53
- expect(follower['skills']).not_to be_nil
54
- end
55
-
56
- it "gets the data for the scoundrel follower from the API" do
57
- follower = BnetApi::D3.follower_data('scoundrel')
58
-
59
- expect(follower['slug']).to eq 'scoundrel'
60
- expect(follower['name']).to eq 'Scoundrel'
61
- expect(follower['realName']).to eq 'd3.follower.scoundrel.realName'
62
- expect(follower['portrait']).to eq 'scoundrel'
63
- expect(follower['skills']).not_to be_nil
64
- end
65
-
66
- it "gets the data for the blacksmith artisan from the API" do
67
- artisan = BnetApi::D3.artisan_data('blacksmith')
68
-
69
- expect(artisan['slug']).to eq 'blacksmith'
70
- expect(artisan['name']).to eq 'Blacksmith'
71
- expect(artisan['portrait']).to eq 'pt_blacksmith'
72
- expect(artisan['training']).not_to be_nil
73
- end
74
-
75
- it "gets the data for the jeweler artisan from the API" do
76
- artisan = BnetApi::D3.artisan_data('jeweler')
77
-
78
- expect(artisan['slug']).to eq 'jeweler'
79
- expect(artisan['name']).to eq 'Jeweler'
80
- expect(artisan['portrait']).to eq 'pt_jeweler'
81
- expect(artisan['training']).not_to be_nil
82
- end
83
-
84
- it "gets the data for the mystic artisan from the API" do
85
- artisan = BnetApi::D3.artisan_data('mystic')
86
-
87
- expect(artisan['slug']).to eq 'mystic'
88
- expect(artisan['name']).to eq 'Mystic'
89
- expect(artisan['portrait']).to eq 'pt_mystic'
90
- expect(artisan['training']).not_to be_nil
91
- end
1
+ require 'spec_helper'
2
+
3
+ describe BnetApi::D3 do
4
+
5
+ before :each do
6
+ BnetApi.configure do |config|
7
+ config.api_key = ENV['BNET_API_KEY']
8
+ config.api_secret = ENV['BNET_API_SECRET']
9
+ end
10
+ end
11
+
12
+ it "gets a career profile from the API" do
13
+ profile = BnetApi::D3.career_profile('Ragwolf#2851')
14
+
15
+ expect(profile['battleTag']).to eq 'Ragwolf#2851'
16
+ expect(profile['heroes']).not_to be_nil
17
+ end
18
+
19
+ it "gets a hero profile from the API" do
20
+ profile = BnetApi::D3.hero_profile('Ragwolf#2851', 47516365)
21
+
22
+ expect(profile['name']).to eq 'Ragwolf'
23
+ expect(profile['class']).to eq 'demon-hunter'
24
+ expect(profile['skills']).not_to be_nil
25
+ end
26
+
27
+ it "gets the data for an item from the API" do
28
+ item = BnetApi::D3.item_data('Co4BCJbokeUHEgcIBBV_-U5dHcj6vKAdjs3dnR2dB5UkHSCd5AQd6XAvux3DDZzlIgsIARW1RAMAGAogJjCLAjjqA0AASBNQEFgEYOwEaisKDAgAEMPSgK2BgIDAEhIbCJ7JnZUJEgcIBBUVn9irMIsCOABAAVgEkAEBpQEgneQErQFmIwZQuAHSiJmSBcABBhj-5ffUC1AAWAI')
29
+
30
+ expect(item['id']).to eq 'Helm_208'
31
+ expect(item['name']).to eq 'Prime Shelter'
32
+ expect(item['icon']).to eq 'helm_208_demonhunter_male'
33
+ expect(item['displayColor']).to eq 'yellow'
34
+ end
35
+
36
+ it "gets the data for the templar follower from the API" do
37
+ follower = BnetApi::D3.follower_data('templar')
38
+
39
+ expect(follower['slug']).to eq 'templar'
40
+ expect(follower['name']).to eq 'Templar'
41
+ expect(follower['realName']).to eq 'd3.follower.templar.realName'
42
+ expect(follower['portrait']).to eq 'templar'
43
+ expect(follower['skills']).not_to be_nil
44
+ end
45
+
46
+ it "gets the data for the enchantress follower from the API" do
47
+ follower = BnetApi::D3.follower_data('enchantress')
48
+
49
+ expect(follower['slug']).to eq 'enchantress'
50
+ expect(follower['name']).to eq 'Enchantress'
51
+ expect(follower['realName']).to eq 'd3.follower.enchantress.realName'
52
+ expect(follower['portrait']).to eq 'enchantress'
53
+ expect(follower['skills']).not_to be_nil
54
+ end
55
+
56
+ it "gets the data for the scoundrel follower from the API" do
57
+ follower = BnetApi::D3.follower_data('scoundrel')
58
+
59
+ expect(follower['slug']).to eq 'scoundrel'
60
+ expect(follower['name']).to eq 'Scoundrel'
61
+ expect(follower['realName']).to eq 'd3.follower.scoundrel.realName'
62
+ expect(follower['portrait']).to eq 'scoundrel'
63
+ expect(follower['skills']).not_to be_nil
64
+ end
65
+
66
+ it "gets the data for the blacksmith artisan from the API" do
67
+ artisan = BnetApi::D3.artisan_data('blacksmith')
68
+
69
+ expect(artisan['slug']).to eq 'blacksmith'
70
+ expect(artisan['name']).to eq 'Blacksmith'
71
+ expect(artisan['portrait']).to eq 'pt_blacksmith'
72
+ expect(artisan['training']).not_to be_nil
73
+ end
74
+
75
+ it "gets the data for the jeweler artisan from the API" do
76
+ artisan = BnetApi::D3.artisan_data('jeweler')
77
+
78
+ expect(artisan['slug']).to eq 'jeweler'
79
+ expect(artisan['name']).to eq 'Jeweler'
80
+ expect(artisan['portrait']).to eq 'pt_jeweler'
81
+ expect(artisan['training']).not_to be_nil
82
+ end
83
+
84
+ it "gets the data for the mystic artisan from the API" do
85
+ artisan = BnetApi::D3.artisan_data('mystic')
86
+
87
+ expect(artisan['slug']).to eq 'mystic'
88
+ expect(artisan['name']).to eq 'Mystic'
89
+ expect(artisan['portrait']).to eq 'pt_mystic'
90
+ expect(artisan['training']).not_to be_nil
91
+ end
92
92
  end