d2ad 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/d2ad.rb +12 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddb97ebc492cc7cbd3be8c49157bd6af7c1732d3
4
- data.tar.gz: 25534d21bc128d2f611b20748c909647e5833371
3
+ metadata.gz: 4e12d1bcaa410f8ebe01b274dc795a88fb93abd1
4
+ data.tar.gz: 5dc03e9af9f5ca75888daa9bc1dddaac817ed569
5
5
  SHA512:
6
- metadata.gz: 2a0cc456eeb84d3810a9e8e7005d3881bb74ecafa862ca63643d1a4bbd5cd3e1da81e8cca9408306128e8d7c2924e7e0c9c31252877a45ed066a17526e177dbe
7
- data.tar.gz: 546163af8b97a3bce20e82c6f290eb6f86816f9a7602d1592368e5ca953a9c4657fc4fa561681e0f89aecf2e673e5a6d4331c71b34651cae0f89de8f131f25fa
6
+ metadata.gz: 239b718b910c603c171cb91139d34c9b9e80f38ef4aa62a25fe2677d8afc85932fc444a01bc5f5cd6f52194fbd41a373d7ded70835dc7503e86bc6113f5e14b0
7
+ data.tar.gz: 6657d23718ccd7a4ad49d911a3f47d7df37320ce8667e2451f7b873229e872b83e9fe369d25aed4ec6fd2779168a926577aa6d0d8cfed963cd4783399ef830c0
@@ -10,18 +10,21 @@ module D2AD
10
10
  end
11
11
 
12
12
  def self.abilities(api_key, match_id)
13
- #this assumes we're being called from a script in the 'bin' directory of this gem
14
- gem_dir = Dir.getwd.chomp('/bin')
15
- abilities = JSON.parse(File.read(gem_dir + '/lib/d2ad/abilities.json'))
16
- match_details = JSON.parse(DotaAPI.query(api_key, 'GetMatchDetails', { match_id: match_id }))
13
+ begin
14
+ lib_dir = File.expand_path(File.dirname(__FILE__))
15
+ abilities = JSON.parse(File.read("#{lib_dir}/d2ad/abilities.json"))
16
+ match_details = JSON.parse(DotaAPI.query(api_key, 'GetMatchDetails', { match_id: match_id }))
17
17
 
18
- match_details['result']['players'].each do |p|
19
- puts "\naccount_id: #{p['account_id']}"
20
- p['ability_upgrades'].each do |u|
21
- abilities['abilities'].each do |a|
22
- puts " #{u['level'].to_s.rjust(2)}: #{a['name']}" if u['ability'].to_s == a['id']
18
+ match_details['result']['players'].each do |p|
19
+ puts "\naccount_id: #{p['account_id']}"
20
+ p['ability_upgrades'].each do |u|
21
+ abilities['abilities'].each do |a|
22
+ puts " #{u['level'].to_s.rjust(2)}: #{a['name']}" if u['ability'].to_s == a['id']
23
+ end
23
24
  end
24
25
  end
26
+ rescue Exception => e
27
+ puts e.inspect
25
28
  end
26
29
 
27
30
  nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: d2ad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Scheurich