Ruby Gem for OpenDotaApi
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
Gemfile
Gemfile.lock
LICENSE
MIT-LICENSE
README.md
Rakefile
open_dota_api.gemspec

README.md

odra

💎 Unofficial Ruby Gem for OpenDotaAPI. This API provides Dota 2 related data.

Gem Version Build Status Code Climate Test Coverage

⚠️ Please keep request rate to approximately 3/s.

Installation

If you use Rubygems you can type:

gem install open_dota_api

or add this line to your application's Gemfile:

gem 'open_dota_api'

then execute:

$ bundle

Using

To use OpenDotaApi you can:

require 'open_dota_api'

Use available methods to gather needed data:

# Leagues listing
OpenDotaApi.leagues

# Teams listing
OpenDotaApi.teams

# Match details
OpenDotaApi.matches(match_id)

# Heroes listing
OpenDotaApi.heroes

# Pro players listing
OpenDotaApi.pro_players

# Explorer output (limited)
OpenDotaApi.explorer(league_id)

Endpoints

🔷 Leagues

API Method: leagues
leagues = OpenDotaApi.leagues
leagues                # array
league = leagues.first
league.class           # OpenDotaApi::Leagues
league.league_id       # Number, league ID
league.ticket          # String, ticket identifier
league.banner          # String, banner identifier
league.tier            # String, premiere, pro, amateur
league.name            # String, league name

🔷 Teams

API Method: teams
teams = OpenDotaApi.teams
teams                  # array
team = teams.first
team.class             # OpenDotaApi::Team
team.team_id
team.rating
team.wins
team.losses
team.last_match_time
team.name
team.tag

🔷 Matches

API Method: matches
match_id = 0000000001        # number, is required
match = OpenDotaApi.matches(match_id)
match.class                  # OpenDotaApi::Match
match.match_id
match.start_time
match.duration
match.series_id
match.series_type
match.radiant_team_id
match.dire_team_id
match.match_seq_num
match.league_id
match.first_blood_time
match.winner
match.cluster
match.replay_salt
match.cluster
match.replay_url
match.radiant_score         # Integer
match.dire_score            # Integer
match.players               # array of players (type OpenDotaApi::Matches::Player)
🔹 Player
players = match.players 
player = players.first
player.class                # OpenDotaApi::Matches::Player
player.match_id             # related to OpenDotaApi::Match
player.player_slot
player.account_id
player.assists
player.camps_stacked
player.deaths
player.denies
player.gold_per_min
player.hero_id              # related to OpenDotaApi::Hero
player.kills
player.obs_placed
player.sen_placed
player.rune_pickups
player.stuns
player.xp_per_min
player.name
player.side
player.kda
player.tower_kills
player.roshan_kills
player.hero_healing
player.last_hits
player.firstblood_claimed
player.hero_damage
player.teamfight_participation

🔷 Heroes

API Method: heroes
heroes = OpenDotaApi.heroes
heroes.class              # array        
hero = heroes.first
hero.class                # OpenDotaApi::Hero    
hero.id
hero.name
hero.localized_name       # "Anti-mage"
hero.primary_attr
hero.attack_type
hero.roles                # array of roles
hero.legs

🔷 Pro Players

API Method: proPlayers
pro_players = OpenDotaApi.pro_players
pro_players.class              # array        
pro_player = pro_players.first
pro_player.class               # OpenDotaApi::ProPlayer    
pro_player.account_id
pro_player.steam_id
pro_player.avatar
pro_player.avatar_medium
pro_player.avatar_full
pro_player.profile_url
pro_player.persona_name
pro_player.last_login
pro_player.full_history_time
pro_player.cheese
pro_player.fh_unavailable
pro_player.loc_country_code
pro_player.last_match_time
pro_player.name
pro_player.country_code
pro_player.fantasy_role
pro_player.team_id
pro_player.team_name
pro_player.team_tag
pro_player.is_locked
pro_player.is_pro
pro_player.locked_until

🔷 Explorer

API Method: explorer
explorer = OpenDotaApi.explorer(league_id)
explorer.class                  # OpenDotaApi::Explorer       
explorer.league_matches_ids     # Array of matches IDs for current league 

...

That's all for now.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/vergilet/open_dota_api

Feel free to contribute:

  1. Fork it (https://github.com/vergilet/open_dota_api/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

The gem is available as open source under the terms of the MIT License.

Copyright © 2017 Yaro.

GitHub license