open_dota_api 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +22 -0
- data/lib/open_dota_api.rb +10 -0
- data/lib/open_dota_api/client.rb +47 -0
- data/lib/open_dota_api/connection.rb +12 -0
- data/lib/open_dota_api/entities/instantiable.rb +15 -0
- data/lib/open_dota_api/entity.rb +16 -0
- data/lib/open_dota_api/hero.rb +37 -0
- data/lib/open_dota_api/league.rb +29 -0
- data/lib/open_dota_api/match.rb +70 -0
- data/lib/open_dota_api/matches/player.rb +92 -0
- data/lib/open_dota_api/team.rb +37 -0
- data/lib/open_dota_api/version.rb +3 -0
- data/spec/data/heroes.json +1580 -0
- data/spec/data/leagues.json +11559 -0
- data/spec/data/match.json +16857 -0
- data/spec/data/teams.json +55298 -0
- data/spec/lib/open_dota_api/client_spec.rb +89 -0
- data/spec/lib/open_dota_api/connection_spec.rb +23 -0
- data/spec/lib/open_dota_api/hero_spec.rb +58 -0
- data/spec/lib/open_dota_api/league_spec.rb +48 -0
- data/spec/lib/open_dota_api/match_spec.rb +99 -0
- data/spec/lib/open_dota_api/matches/player_spec.rb +125 -0
- data/spec/lib/open_dota_api/team_spec.rb +58 -0
- data/spec/lib/open_dota_api_spec.rb +11 -0
- data/spec/spec_helper.rb +23 -0
- metadata +181 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OpenDotaApi::Team do
|
4
|
+
let(:team_id) { 2163 }
|
5
|
+
let(:rating) { 1550.24 }
|
6
|
+
let(:wins) { 539 }
|
7
|
+
let(:losses) { 355 }
|
8
|
+
let(:last_match_time) { 1500684592 }
|
9
|
+
let(:name) { 'Team Liquid' }
|
10
|
+
let(:tag) { 'Liquid' }
|
11
|
+
|
12
|
+
let(:teams_file) { File.read('spec/data/teams.json') }
|
13
|
+
let(:response_json) { JSON.parse(teams_file) }
|
14
|
+
let(:teams) { OpenDotaApi::Team.instantiate(response_json) }
|
15
|
+
let(:team) { teams.first }
|
16
|
+
|
17
|
+
it 'returns endpoint' do
|
18
|
+
expect(described_class::ENDPOINT).to eq 'teams'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'inherits entity object' do
|
22
|
+
expect(team).to be_a OpenDotaApi::Entity
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'is instantiable' do
|
26
|
+
expect(team).to be_a OpenDotaApi::Entities::Instantiatable
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'default attributes' do
|
30
|
+
it 'returns team_id' do
|
31
|
+
expect(team.team_id).to eq team_id
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'returns rating' do
|
35
|
+
expect(team.rating).to eq rating
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'returns wins' do
|
39
|
+
expect(team.wins).to eq wins
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns losses' do
|
43
|
+
expect(team.losses).to eq losses
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns last match time' do
|
47
|
+
expect(team.last_match_time).to eq last_match_time
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'returns name' do
|
51
|
+
expect(team.name).to eq name
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'returns tag' do
|
55
|
+
expect(team.tag).to eq tag
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
ENV['RAILS_ENV'] ||= 'test'
|
2
|
+
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start
|
6
|
+
|
7
|
+
require 'open_dota_api'
|
8
|
+
|
9
|
+
ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
|
10
|
+
|
11
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
12
|
+
# in spec/support/ and its subdirectories.
|
13
|
+
Dir[File.join(ENGINE_RAILS_ROOT, 'spec/support/**/*.rb')].each { |f| require f }
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.expect_with :rspec do |expectations|
|
17
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
18
|
+
end
|
19
|
+
|
20
|
+
config.mock_with :rspec do |mocks|
|
21
|
+
mocks.verify_partial_doubles = true
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: open_dota_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yaroslav Oslavskiy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hashable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: listen
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faker
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Ruby wrapper for Open Dota API
|
112
|
+
email:
|
113
|
+
- osyaroslav@gmail.com.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- MIT-LICENSE
|
119
|
+
- Rakefile
|
120
|
+
- lib/open_dota_api.rb
|
121
|
+
- lib/open_dota_api/client.rb
|
122
|
+
- lib/open_dota_api/connection.rb
|
123
|
+
- lib/open_dota_api/entities/instantiable.rb
|
124
|
+
- lib/open_dota_api/entity.rb
|
125
|
+
- lib/open_dota_api/hero.rb
|
126
|
+
- lib/open_dota_api/league.rb
|
127
|
+
- lib/open_dota_api/match.rb
|
128
|
+
- lib/open_dota_api/matches/player.rb
|
129
|
+
- lib/open_dota_api/team.rb
|
130
|
+
- lib/open_dota_api/version.rb
|
131
|
+
- spec/data/heroes.json
|
132
|
+
- spec/data/leagues.json
|
133
|
+
- spec/data/match.json
|
134
|
+
- spec/data/teams.json
|
135
|
+
- spec/lib/open_dota_api/client_spec.rb
|
136
|
+
- spec/lib/open_dota_api/connection_spec.rb
|
137
|
+
- spec/lib/open_dota_api/hero_spec.rb
|
138
|
+
- spec/lib/open_dota_api/league_spec.rb
|
139
|
+
- spec/lib/open_dota_api/match_spec.rb
|
140
|
+
- spec/lib/open_dota_api/matches/player_spec.rb
|
141
|
+
- spec/lib/open_dota_api/team_spec.rb
|
142
|
+
- spec/lib/open_dota_api_spec.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
homepage: https://github.com/vergilet/open-dota-api
|
145
|
+
licenses:
|
146
|
+
- MIT
|
147
|
+
metadata: {}
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubyforge_project:
|
164
|
+
rubygems_version: 2.6.12
|
165
|
+
signing_key:
|
166
|
+
specification_version: 4
|
167
|
+
summary: Ruby wrapper for Open Dota API
|
168
|
+
test_files:
|
169
|
+
- spec/data/heroes.json
|
170
|
+
- spec/data/leagues.json
|
171
|
+
- spec/data/match.json
|
172
|
+
- spec/data/teams.json
|
173
|
+
- spec/lib/open_dota_api/client_spec.rb
|
174
|
+
- spec/lib/open_dota_api/connection_spec.rb
|
175
|
+
- spec/lib/open_dota_api/hero_spec.rb
|
176
|
+
- spec/lib/open_dota_api/league_spec.rb
|
177
|
+
- spec/lib/open_dota_api/match_spec.rb
|
178
|
+
- spec/lib/open_dota_api/matches/player_spec.rb
|
179
|
+
- spec/lib/open_dota_api/team_spec.rb
|
180
|
+
- spec/lib/open_dota_api_spec.rb
|
181
|
+
- spec/spec_helper.rb
|