diablo_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +45 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +13 -0
- data/Guardfile +23 -0
- data/LICENSE +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/diablo_api.gemspec +33 -0
- data/lib/diablo_api/career.rb +24 -0
- data/lib/diablo_api/config.rb +25 -0
- data/lib/diablo_api/hero.rb +26 -0
- data/lib/diablo_api/models/data/artisan.rb +6 -0
- data/lib/diablo_api/models/data/follower.rb +6 -0
- data/lib/diablo_api/models/data/item.rb +109 -0
- data/lib/diablo_api/models/icons/item.rb +12 -0
- data/lib/diablo_api/models/icons/skill.rb +15 -0
- data/lib/diablo_api/models/profile/career.rb +114 -0
- data/lib/diablo_api/models/profile/hero.rb +89 -0
- data/lib/diablo_api/models/profiles/career.rb +114 -0
- data/lib/diablo_api/models/profiles/hero.rb +89 -0
- data/lib/diablo_api/version.rb +3 -0
- data/lib/diablo_api.rb +15 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d046ef4858a3236fc086d2e235072e830049b656
|
4
|
+
data.tar.gz: 14917d5e467877afc0661a304dfd1acfaa2e62d1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 41c459ecece56634cd0b74d2184e835ac4127c2f61ec6554ed99d13e659bad33d60dd80673caba4005f12d3fcdfcc8e814173323e4c1edd783e98975186b6b11
|
7
|
+
data.tar.gz: 520b92ed50742e3adb13d1cb68c05983a31f01d79e187b00c7e5e96f25b70fa4e2e8390d3b85bec1c84bee56598ba4250f6ed8907c34dbada38914d6fd503307
|
data/.gitignore
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
/config/
|
11
|
+
*.gem
|
12
|
+
*.rbc
|
13
|
+
/.config
|
14
|
+
/coverage/
|
15
|
+
/InstalledFiles
|
16
|
+
/pkg/
|
17
|
+
/spec/reports/
|
18
|
+
/test/tmp/
|
19
|
+
/test/version_tmp/
|
20
|
+
/tmp/
|
21
|
+
|
22
|
+
## Specific to RubyMotion:
|
23
|
+
.dat*
|
24
|
+
.repl_history
|
25
|
+
build/
|
26
|
+
|
27
|
+
## Documentation cache and generated files:
|
28
|
+
/.yardoc/
|
29
|
+
/_yardoc/
|
30
|
+
/doc/
|
31
|
+
/rdoc/
|
32
|
+
|
33
|
+
## Environment normalisation:
|
34
|
+
/.bundle/
|
35
|
+
/vendor/bundle
|
36
|
+
/lib/bundler/man/
|
37
|
+
|
38
|
+
# for a library or gem, you might want to ignore these files since the code is
|
39
|
+
# intended to run in multiple environments; otherwise, check them in:
|
40
|
+
# Gemfile.lock
|
41
|
+
# .ruby-version
|
42
|
+
# .ruby-gemset
|
43
|
+
|
44
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
45
|
+
.rvmrc
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
guard :rspec, all_after_pass: false, all_on_start: false, cmd: 'bundle exec rspec' do
|
18
|
+
watch(%r{^lib/diablo_api/(.+)\.rb}) { |m| "spec/lib/diablo_api/#{m[1]}_spec.rb" }
|
19
|
+
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
20
|
+
watch('spec/lib/diablo_api_spec.rb')
|
21
|
+
watch('spec/lib/diablo_api/career_spec.rb')
|
22
|
+
watch('spec/lib/diablo_api/hero_spec.rb')
|
23
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 SwamiRama
|
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
|
+
SOFTWARE.
|
22
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Jimmi
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# DiabloApi
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/diablo_api`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'diablo_api'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install diablo_api
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/diablo_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "diablo_api"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/diablo_api.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'diablo_api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "diablo_api"
|
8
|
+
spec.version = DiabloApi::VERSION
|
9
|
+
spec.authors = ["Jimmi"]
|
10
|
+
spec.email = ["jimmi@rl-hosting.de"]
|
11
|
+
|
12
|
+
spec.summary = "Fetch data from Blizzards API and more"
|
13
|
+
spec.description = "This gem makes it easy to fetch data from Blizzards API..."
|
14
|
+
spec.homepage = "https://github.com/SwamiRama/diablo_api"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = ""
|
21
|
+
#else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
#end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec"
|
33
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'diablo_api/models/profiles/career'
|
2
|
+
module DiabloApi
|
3
|
+
class Career
|
4
|
+
include DiabloApi::Profiles::Career
|
5
|
+
attr_reader :region, :locale, :battle_tag, :data
|
6
|
+
|
7
|
+
def initialize(region, locale, battle_tag)
|
8
|
+
@region = region
|
9
|
+
@locale = locale
|
10
|
+
@battle_tag = battle_tag
|
11
|
+
fetch
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def fetch
|
17
|
+
@data = JSON.load(open(build_url).read)
|
18
|
+
end
|
19
|
+
|
20
|
+
def build_url
|
21
|
+
"https://#{@region}.api.battle.net/d3/profile/#{URI.escape(@battle_tag)}/?locale=#{@locale}&apikey=#{DiabloApi::Config.configuration.api_key}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module DiabloApi
|
2
|
+
module Config
|
3
|
+
class << self
|
4
|
+
attr_accessor :configuration
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.configure
|
8
|
+
self.configuration ||= Configuration.new
|
9
|
+
yield(configuration)
|
10
|
+
end
|
11
|
+
|
12
|
+
class Configuration
|
13
|
+
attr_accessor :api_key
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@api_key = ENV["DIABLO_API_KEY"] || YAML.load_file('config/api_key.yaml')['API_KEY']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# require 'diablo_api'
|
23
|
+
# DiabloApi::Config.configure do |config
|
24
|
+
# cconfig.api_key = "my-new-key"
|
25
|
+
# end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'diablo_api/models/profiles/hero'
|
2
|
+
module DiabloApi
|
3
|
+
class Hero
|
4
|
+
include DiabloApi::Profiles::Hero
|
5
|
+
attr_reader :region, :locale, :battle_tag, :hero_id, :data
|
6
|
+
|
7
|
+
def initialize(region, locale, battle_tag, hero_id)
|
8
|
+
@region = region
|
9
|
+
@locale = locale
|
10
|
+
@battle_tag = battle_tag
|
11
|
+
@hero_id = hero_id
|
12
|
+
fetch
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def fetch
|
18
|
+
@data = JSON.load(open(build_url).read)
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_url
|
22
|
+
|
23
|
+
"https://#{@region}.api.battle.net/d3/profile/#{URI.escape(@battle_tag)}/hero/#{@hero_id}?locale=#{@locale}&apikey=#{DiabloApi::Config.configuration.api_key}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module DiabloApi
|
2
|
+
module Data
|
3
|
+
module Item
|
4
|
+
def id
|
5
|
+
@date['id']
|
6
|
+
end
|
7
|
+
|
8
|
+
def name
|
9
|
+
@date['name']
|
10
|
+
end
|
11
|
+
|
12
|
+
def icon
|
13
|
+
@date['icon']
|
14
|
+
end
|
15
|
+
|
16
|
+
def displayColor
|
17
|
+
@date['displayColor']
|
18
|
+
end
|
19
|
+
|
20
|
+
def tooltipParams
|
21
|
+
@date['tooltipParams']
|
22
|
+
end
|
23
|
+
|
24
|
+
def requiredLevel
|
25
|
+
@date['requiredLevel']
|
26
|
+
end
|
27
|
+
|
28
|
+
def itemLevel
|
29
|
+
@date['itemLevel']
|
30
|
+
end
|
31
|
+
|
32
|
+
def stackSizeMax
|
33
|
+
@date['stackSizeMax']
|
34
|
+
end
|
35
|
+
|
36
|
+
def bonusAffixes
|
37
|
+
@date['bonusAffixes']
|
38
|
+
end
|
39
|
+
|
40
|
+
def bonusAffixesMax
|
41
|
+
@date['bonusAffixesMax']
|
42
|
+
end
|
43
|
+
|
44
|
+
def accountBound
|
45
|
+
@date['accountBound']
|
46
|
+
end
|
47
|
+
|
48
|
+
def flavorText
|
49
|
+
@date['flavorText']
|
50
|
+
end
|
51
|
+
|
52
|
+
def typeName
|
53
|
+
@date['typeName']
|
54
|
+
end
|
55
|
+
|
56
|
+
def type
|
57
|
+
@date['type']
|
58
|
+
end
|
59
|
+
|
60
|
+
def damageRange
|
61
|
+
@date['damageRange']
|
62
|
+
end
|
63
|
+
|
64
|
+
def slots
|
65
|
+
@date['slots']
|
66
|
+
end
|
67
|
+
|
68
|
+
def attributes
|
69
|
+
@date['attributes']
|
70
|
+
end
|
71
|
+
|
72
|
+
def attributesRaw
|
73
|
+
@date['attributesRaw']
|
74
|
+
end
|
75
|
+
|
76
|
+
def randomAffixes
|
77
|
+
@date['randomAffixes']
|
78
|
+
end
|
79
|
+
|
80
|
+
def gems
|
81
|
+
@date['gems']
|
82
|
+
end
|
83
|
+
|
84
|
+
def socketEffects
|
85
|
+
@date['socketEffects']
|
86
|
+
end
|
87
|
+
|
88
|
+
def craftedBy
|
89
|
+
@date['craftedBy']
|
90
|
+
end
|
91
|
+
|
92
|
+
def seasonRequiredToDrop
|
93
|
+
@date['seasonRequiredToDrop']
|
94
|
+
end
|
95
|
+
|
96
|
+
def isSeasonRequiredToDrop
|
97
|
+
@date['isSeasonRequiredToDrop']
|
98
|
+
end
|
99
|
+
|
100
|
+
def description
|
101
|
+
@date['description']
|
102
|
+
end
|
103
|
+
|
104
|
+
def blockChance
|
105
|
+
@date['blockChance']
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module DiabloApi
|
2
|
+
module Icons
|
3
|
+
module Item
|
4
|
+
def small(icon)
|
5
|
+
url = 'http://media.blizzard.com/d3/icons/items/small/' << icon << '.png'
|
6
|
+
end
|
7
|
+
def large(icon)
|
8
|
+
url = 'http://media.blizzard.com/d3/icons/items/large/' << icon << '.png'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module DiabloApi
|
2
|
+
module Icons
|
3
|
+
module Skill
|
4
|
+
def small(icon)
|
5
|
+
url = 'http://media.blizzard.com/d3/icons/skills/21/' << icon << '.png'
|
6
|
+
end
|
7
|
+
def middle(icon)
|
8
|
+
url = 'http://media.blizzard.com/d3/icons/skills/42/' << icon << '.png'
|
9
|
+
end
|
10
|
+
def large(icon)
|
11
|
+
url = 'http://media.blizzard.com/d3/icons/skills/64/' << icon << '.png'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module DiabloApi
|
6
|
+
module Profile
|
7
|
+
module Career
|
8
|
+
def main_data
|
9
|
+
ignore = %w(Hash Array)
|
10
|
+
md = {}
|
11
|
+
@data.each do |k, v|
|
12
|
+
md[k] = v unless ignore.include? v.class.to_s
|
13
|
+
end
|
14
|
+
md
|
15
|
+
end
|
16
|
+
|
17
|
+
def battle_tag
|
18
|
+
@data['battleTag']
|
19
|
+
end
|
20
|
+
|
21
|
+
def paragon_level
|
22
|
+
@data['paragonLevel']
|
23
|
+
end
|
24
|
+
|
25
|
+
def paragon_level_hardcore
|
26
|
+
@data['paragonLevelHardcore']
|
27
|
+
end
|
28
|
+
|
29
|
+
def paragon_level_season
|
30
|
+
@data['paragonLevelSeason']
|
31
|
+
end
|
32
|
+
|
33
|
+
def paragon_level_season_hardcore
|
34
|
+
@data['paragonLevelSeasonHardcore']
|
35
|
+
end
|
36
|
+
|
37
|
+
def guild_name
|
38
|
+
@data['guildName']
|
39
|
+
end
|
40
|
+
|
41
|
+
def heroes
|
42
|
+
@data['heroes']
|
43
|
+
end
|
44
|
+
|
45
|
+
def last_hero_played
|
46
|
+
@data['lastHeroPlayed']
|
47
|
+
end
|
48
|
+
|
49
|
+
def last_updated
|
50
|
+
@data['lastUpdated']
|
51
|
+
end
|
52
|
+
|
53
|
+
def kills
|
54
|
+
@data['kills']
|
55
|
+
end
|
56
|
+
|
57
|
+
def highest_hardcore_level
|
58
|
+
@data['highestHardcoreLevel']
|
59
|
+
end
|
60
|
+
|
61
|
+
def time_played
|
62
|
+
@data['timePlayed']
|
63
|
+
end
|
64
|
+
|
65
|
+
def progression
|
66
|
+
@data['progression']
|
67
|
+
end
|
68
|
+
|
69
|
+
def fallen_heroes
|
70
|
+
@data['fallenHeroes']
|
71
|
+
end
|
72
|
+
|
73
|
+
def blacksmith
|
74
|
+
@data['blacksmith']
|
75
|
+
end
|
76
|
+
|
77
|
+
def jeweler
|
78
|
+
@data['jeweler']
|
79
|
+
end
|
80
|
+
|
81
|
+
def mystic
|
82
|
+
@data['mystic']
|
83
|
+
end
|
84
|
+
|
85
|
+
def blacksmith_hardcore
|
86
|
+
@data['blacksmithHardcore']
|
87
|
+
end
|
88
|
+
|
89
|
+
def jeweler_hardcore
|
90
|
+
@data['jewelerHardcore']
|
91
|
+
end
|
92
|
+
|
93
|
+
def mystic_hardcore
|
94
|
+
@data['mysticHardcore']
|
95
|
+
end
|
96
|
+
|
97
|
+
def blacksmith_season
|
98
|
+
@data['blacksmithSeason']
|
99
|
+
end
|
100
|
+
|
101
|
+
def jeweler_season
|
102
|
+
@data['jewelerSeason']
|
103
|
+
end
|
104
|
+
|
105
|
+
def mystic_season
|
106
|
+
@data['mysticSeason']
|
107
|
+
end
|
108
|
+
|
109
|
+
def seasonal_profiles
|
110
|
+
@data['seasonalProfiles']
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
module DiabloApi
|
5
|
+
module Profile
|
6
|
+
module Hero
|
7
|
+
def main_data
|
8
|
+
ignore = %w(Hash Array)
|
9
|
+
md = {}
|
10
|
+
@data.each do |k, v|
|
11
|
+
md[k] = v unless ignore.include? v.class.to_s
|
12
|
+
end
|
13
|
+
md
|
14
|
+
end
|
15
|
+
|
16
|
+
def id
|
17
|
+
@data['id']
|
18
|
+
end
|
19
|
+
|
20
|
+
def name
|
21
|
+
@data['name']
|
22
|
+
end
|
23
|
+
|
24
|
+
def class
|
25
|
+
@data['class']
|
26
|
+
end
|
27
|
+
|
28
|
+
def gender
|
29
|
+
@data['gender']
|
30
|
+
end
|
31
|
+
|
32
|
+
def level
|
33
|
+
@data['level']
|
34
|
+
end
|
35
|
+
|
36
|
+
def kills
|
37
|
+
@data['kills']
|
38
|
+
end
|
39
|
+
|
40
|
+
def paragon_level
|
41
|
+
@data['paragonLevel']
|
42
|
+
end
|
43
|
+
|
44
|
+
def hardcore
|
45
|
+
@data['hardcore']
|
46
|
+
end
|
47
|
+
|
48
|
+
def seasonal
|
49
|
+
@data['seasonal']
|
50
|
+
end
|
51
|
+
|
52
|
+
def seasonCreated
|
53
|
+
@data['seasonCreated']
|
54
|
+
end
|
55
|
+
|
56
|
+
def skills
|
57
|
+
@data['skills']
|
58
|
+
end
|
59
|
+
|
60
|
+
def items
|
61
|
+
@data['items']
|
62
|
+
end
|
63
|
+
|
64
|
+
def followers
|
65
|
+
@data['followers']
|
66
|
+
end
|
67
|
+
|
68
|
+
def legendaryPowers
|
69
|
+
@data['legendaryPowers']
|
70
|
+
end
|
71
|
+
|
72
|
+
def stats
|
73
|
+
@data['stats']
|
74
|
+
end
|
75
|
+
|
76
|
+
def progression
|
77
|
+
@data['progression']
|
78
|
+
end
|
79
|
+
|
80
|
+
def dead
|
81
|
+
@data['dead']
|
82
|
+
end
|
83
|
+
|
84
|
+
def last_updated
|
85
|
+
@data['last-updated']
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module DiabloApi
|
6
|
+
module Profiles
|
7
|
+
module Career
|
8
|
+
def main_data
|
9
|
+
ignore = %w(Hash Array)
|
10
|
+
md = {}
|
11
|
+
@data.each do |k, v|
|
12
|
+
md[k] = v unless ignore.include? v.class.to_s
|
13
|
+
end
|
14
|
+
md
|
15
|
+
end
|
16
|
+
|
17
|
+
def battle_tag
|
18
|
+
@data['battleTag']
|
19
|
+
end
|
20
|
+
|
21
|
+
def paragon_level
|
22
|
+
@data['paragonLevel']
|
23
|
+
end
|
24
|
+
|
25
|
+
def paragon_level_hardcore
|
26
|
+
@data['paragonLevelHardcore']
|
27
|
+
end
|
28
|
+
|
29
|
+
def paragon_level_season
|
30
|
+
@data['paragonLevelSeason']
|
31
|
+
end
|
32
|
+
|
33
|
+
def paragon_level_season_hardcore
|
34
|
+
@data['paragonLevelSeasonHardcore']
|
35
|
+
end
|
36
|
+
|
37
|
+
def guild_name
|
38
|
+
@data['guildName']
|
39
|
+
end
|
40
|
+
|
41
|
+
def heroes
|
42
|
+
@data['heroes']
|
43
|
+
end
|
44
|
+
|
45
|
+
def last_hero_played
|
46
|
+
@data['lastHeroPlayed']
|
47
|
+
end
|
48
|
+
|
49
|
+
def last_updated
|
50
|
+
@data['lastUpdated']
|
51
|
+
end
|
52
|
+
|
53
|
+
def kills
|
54
|
+
@data['kills']
|
55
|
+
end
|
56
|
+
|
57
|
+
def highest_hardcore_level
|
58
|
+
@data['highestHardcoreLevel']
|
59
|
+
end
|
60
|
+
|
61
|
+
def time_played
|
62
|
+
@data['timePlayed']
|
63
|
+
end
|
64
|
+
|
65
|
+
def progression
|
66
|
+
@data['progression']
|
67
|
+
end
|
68
|
+
|
69
|
+
def fallen_heroes
|
70
|
+
@data['fallenHeroes']
|
71
|
+
end
|
72
|
+
|
73
|
+
def blacksmith
|
74
|
+
@data['blacksmith']
|
75
|
+
end
|
76
|
+
|
77
|
+
def jeweler
|
78
|
+
@data['jeweler']
|
79
|
+
end
|
80
|
+
|
81
|
+
def mystic
|
82
|
+
@data['mystic']
|
83
|
+
end
|
84
|
+
|
85
|
+
def blacksmith_hardcore
|
86
|
+
@data['blacksmithHardcore']
|
87
|
+
end
|
88
|
+
|
89
|
+
def jeweler_hardcore
|
90
|
+
@data['jewelerHardcore']
|
91
|
+
end
|
92
|
+
|
93
|
+
def mystic_hardcore
|
94
|
+
@data['mysticHardcore']
|
95
|
+
end
|
96
|
+
|
97
|
+
def blacksmith_season
|
98
|
+
@data['blacksmithSeason']
|
99
|
+
end
|
100
|
+
|
101
|
+
def jeweler_season
|
102
|
+
@data['jewelerSeason']
|
103
|
+
end
|
104
|
+
|
105
|
+
def mystic_season
|
106
|
+
@data['mysticSeason']
|
107
|
+
end
|
108
|
+
|
109
|
+
def seasonal_profiles
|
110
|
+
@data['seasonalProfiles']
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
module DiabloApi
|
5
|
+
module Profiles
|
6
|
+
module Hero
|
7
|
+
def main_data
|
8
|
+
ignore = %w(Hash Array)
|
9
|
+
md = {}
|
10
|
+
@data.each do |k, v|
|
11
|
+
md[k] = v unless ignore.include? v.class.to_s
|
12
|
+
end
|
13
|
+
md
|
14
|
+
end
|
15
|
+
|
16
|
+
def id
|
17
|
+
@data['id']
|
18
|
+
end
|
19
|
+
|
20
|
+
def name
|
21
|
+
@data['name']
|
22
|
+
end
|
23
|
+
|
24
|
+
def class
|
25
|
+
@data['class']
|
26
|
+
end
|
27
|
+
|
28
|
+
def gender
|
29
|
+
@data['gender']
|
30
|
+
end
|
31
|
+
|
32
|
+
def level
|
33
|
+
@data['level']
|
34
|
+
end
|
35
|
+
|
36
|
+
def kills
|
37
|
+
@data['kills']
|
38
|
+
end
|
39
|
+
|
40
|
+
def paragon_level
|
41
|
+
@data['paragonLevel']
|
42
|
+
end
|
43
|
+
|
44
|
+
def hardcore
|
45
|
+
@data['hardcore']
|
46
|
+
end
|
47
|
+
|
48
|
+
def seasonal
|
49
|
+
@data['seasonal']
|
50
|
+
end
|
51
|
+
|
52
|
+
def season_created
|
53
|
+
@data['seasonCreated']
|
54
|
+
end
|
55
|
+
|
56
|
+
def skills
|
57
|
+
@data['skills']
|
58
|
+
end
|
59
|
+
|
60
|
+
def items
|
61
|
+
@data['items']
|
62
|
+
end
|
63
|
+
|
64
|
+
def followers
|
65
|
+
@data['followers']
|
66
|
+
end
|
67
|
+
|
68
|
+
def legendary_powers
|
69
|
+
@data['legendaryPowers']
|
70
|
+
end
|
71
|
+
|
72
|
+
def stats
|
73
|
+
@data['stats']
|
74
|
+
end
|
75
|
+
|
76
|
+
def progression
|
77
|
+
@data['progression']
|
78
|
+
end
|
79
|
+
|
80
|
+
def dead
|
81
|
+
@data['dead']
|
82
|
+
end
|
83
|
+
|
84
|
+
def last_updated
|
85
|
+
@data['last-updated']
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/lib/diablo_api.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "diablo_api/version"
|
2
|
+
require "diablo_api/config"
|
3
|
+
require "diablo_api/career"
|
4
|
+
require "diablo_api/hero"
|
5
|
+
|
6
|
+
module DiabloApi
|
7
|
+
# def self.career(region, locale, battle_tag)
|
8
|
+
# data = data(region, locale, battle_tag)
|
9
|
+
# ::Models::Career.new(data)
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# def self.data(region, locale, battle_tag)
|
13
|
+
# @data ||= Data.new(region, locale, battle_tag)
|
14
|
+
# end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: diablo_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jimmi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: This gem makes it easy to fetch data from Blizzards API...
|
56
|
+
email:
|
57
|
+
- jimmi@rl-hosting.de
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- Gemfile
|
67
|
+
- Guardfile
|
68
|
+
- LICENSE
|
69
|
+
- LICENSE.txt
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- bin/console
|
73
|
+
- bin/setup
|
74
|
+
- diablo_api.gemspec
|
75
|
+
- lib/diablo_api.rb
|
76
|
+
- lib/diablo_api/career.rb
|
77
|
+
- lib/diablo_api/config.rb
|
78
|
+
- lib/diablo_api/hero.rb
|
79
|
+
- lib/diablo_api/models/data/artisan.rb
|
80
|
+
- lib/diablo_api/models/data/follower.rb
|
81
|
+
- lib/diablo_api/models/data/item.rb
|
82
|
+
- lib/diablo_api/models/icons/item.rb
|
83
|
+
- lib/diablo_api/models/icons/skill.rb
|
84
|
+
- lib/diablo_api/models/profile/career.rb
|
85
|
+
- lib/diablo_api/models/profile/hero.rb
|
86
|
+
- lib/diablo_api/models/profiles/career.rb
|
87
|
+
- lib/diablo_api/models/profiles/hero.rb
|
88
|
+
- lib/diablo_api/version.rb
|
89
|
+
homepage: https://github.com/SwamiRama/diablo_api
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.8
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Fetch data from Blizzards API and more
|
113
|
+
test_files: []
|