open_dota_api 0.0.2 → 0.0.3
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/lib/open_dota_api/client.rb +2 -2
- data/lib/open_dota_api/hero.rb +1 -1
- data/lib/open_dota_api/league.rb +1 -1
- data/lib/open_dota_api/match.rb +2 -2
- data/lib/open_dota_api/matches/player.rb +0 -1
- data/lib/open_dota_api/team.rb +2 -2
- data/lib/open_dota_api/version.rb +1 -1
- data/spec/lib/open_dota_api/connection_spec.rb +3 -3
- data/spec/lib/open_dota_api/hero_spec.rb +1 -1
- data/spec/lib/open_dota_api/league_spec.rb +1 -1
- data/spec/lib/open_dota_api/match_spec.rb +8 -8
- data/spec/lib/open_dota_api/matches/player_spec.rb +2 -2
- data/spec/lib/open_dota_api/team_spec.rb +1 -1
- data/spec/lib/open_dota_api_spec.rb +1 -1
- metadata +1 -2
- data/Rakefile +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10283b2823ec6879ee2cbc78d3e7a17455a3a806
|
4
|
+
data.tar.gz: eff45f3ecc4dfef96d2d915fa2fee43a0ebfa606
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30840cf124f3c4ef6f24e862d222cab56dfe20e118b9bf262b7715e126172c3d97bdae6ea02dfbafe99d05d0068c6c894a6847904c5fe48b83e7f1e49e391566
|
7
|
+
data.tar.gz: f956ca55c5f2f13d14b3a613b2f8d28020d6680542ed4c71eddc0909aa93786d3970ce5ea92fc0f73c8e6dc7109403c8edc31c61832cf930428bff40d47e2ac9
|
data/lib/open_dota_api/client.rb
CHANGED
@@ -6,7 +6,7 @@ require 'open_dota_api/hero'
|
|
6
6
|
|
7
7
|
module OpenDotaApi
|
8
8
|
class Client
|
9
|
-
INTERFACE = 'api'
|
9
|
+
INTERFACE = 'api'.freeze
|
10
10
|
|
11
11
|
def leagues
|
12
12
|
leagues_data = request(League::ENDPOINT)
|
@@ -21,7 +21,7 @@ module OpenDotaApi
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def matches(match_id = nil)
|
24
|
-
match_data = request(Match::ENDPOINT,
|
24
|
+
match_data = request(Match::ENDPOINT, match_id)
|
25
25
|
return {} unless match_data
|
26
26
|
Match.new(match_data)
|
27
27
|
end
|
data/lib/open_dota_api/hero.rb
CHANGED
data/lib/open_dota_api/league.rb
CHANGED
data/lib/open_dota_api/match.rb
CHANGED
@@ -3,7 +3,7 @@ require 'open_dota_api/matches/player'
|
|
3
3
|
|
4
4
|
module OpenDotaApi
|
5
5
|
class Match < Entity
|
6
|
-
ENDPOINT = 'matches'
|
6
|
+
ENDPOINT = 'matches'.freeze
|
7
7
|
|
8
8
|
def match_id
|
9
9
|
data['match_id']
|
@@ -58,7 +58,7 @@ module OpenDotaApi
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def replay_url
|
61
|
-
"http://replay#{
|
61
|
+
"http://replay#{cluster}.valve.net/570/#{match_id}_#{replay_salt}.dem.bz2"
|
62
62
|
end
|
63
63
|
|
64
64
|
def players
|
data/lib/open_dota_api/team.rb
CHANGED
@@ -9,9 +9,9 @@ describe OpenDotaApi::Connection do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'returns response object' do
|
12
|
-
stub_request(:get,
|
13
|
-
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'})
|
14
|
-
to_return(status: 200, body:
|
12
|
+
stub_request(:get, 'http://api.opendota.com/')
|
13
|
+
.with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Ruby' })
|
14
|
+
.to_return(status: 200, body: '', headers: {})
|
15
15
|
|
16
16
|
expect(OpenDotaApi::Connection.get(pathname).class).to eq HTTParty::Response
|
17
17
|
end
|
@@ -6,7 +6,7 @@ describe OpenDotaApi::Hero do
|
|
6
6
|
let(:localized_name) { 'Anti-Mage' }
|
7
7
|
let(:primary_attr) { 'agi' }
|
8
8
|
let(:attack_type) { 'Melee' }
|
9
|
-
let(:roles) { %w
|
9
|
+
let(:roles) { %w[Carry Escape Nuker] }
|
10
10
|
let(:legs) { 2 }
|
11
11
|
|
12
12
|
let(:heroes_file) { File.read('spec/data/heroes.json') }
|
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe OpenDotaApi::Match do
|
4
|
-
let(:match_id) {
|
5
|
-
let(:start_time) {
|
4
|
+
let(:match_id) { 3_149_215_336 }
|
5
|
+
let(:start_time) { 1_493_566_333 }
|
6
6
|
let(:duration) { 2109 }
|
7
|
-
let(:series_id) {
|
7
|
+
let(:series_id) { 135_248 }
|
8
8
|
let(:series_type) { 2 }
|
9
|
-
let(:radiant_team_id) {
|
10
|
-
let(:dire_team_id) {
|
11
|
-
let(:match_seq_num) {
|
9
|
+
let(:radiant_team_id) { 2_586_976 }
|
10
|
+
let(:dire_team_id) { 1_883_502 }
|
11
|
+
let(:match_seq_num) { 2_750_393_746 }
|
12
12
|
let(:league_id) { 5157 }
|
13
13
|
let(:first_blood_time) { 53 }
|
14
14
|
let(:winner) { :dire }
|
15
15
|
let(:cluster) { 136 }
|
16
|
-
let(:replay_salt) {
|
16
|
+
let(:replay_salt) { 565_926_067 }
|
17
17
|
let(:replay_url) { 'http://replay136.valve.net/570/3149215336_565926067.dem.bz2' }
|
18
18
|
let(:players_length) { 10 }
|
19
19
|
let(:player_class) { OpenDotaApi::Match::Player }
|
@@ -93,7 +93,7 @@ describe OpenDotaApi::Match do
|
|
93
93
|
|
94
94
|
it 'returns players' do
|
95
95
|
expect(match.players.length).to eq players_length
|
96
|
-
expect(match.players.all? { |player| player.
|
96
|
+
expect(match.players.all? { |player| player.is_a? player_class }).to be_truthy
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe OpenDotaApi::Matches::Player do
|
4
|
-
let(:match_id) {
|
4
|
+
let(:match_id) { 3_149_215_336 }
|
5
5
|
let(:player_slot) { 0 }
|
6
|
-
let(:account_id) {
|
6
|
+
let(:account_id) { 94_155_156 }
|
7
7
|
let(:assists) { 13 }
|
8
8
|
let(:camps_stacked) { 4 }
|
9
9
|
let(:deaths) { 7 }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_dota_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Oslavskiy
|
@@ -116,7 +116,6 @@ extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
118
|
- MIT-LICENSE
|
119
|
-
- Rakefile
|
120
119
|
- lib/open_dota_api.rb
|
121
120
|
- lib/open_dota_api/client.rb
|
122
121
|
- lib/open_dota_api/connection.rb
|
data/Rakefile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
6
|
-
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
11
|
-
rdoc.title = 'OpenDotaApi'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.rdoc')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
Bundler::GemHelper.install_tasks
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
task default: :test
|