wot_api 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/lib/wot_api/base.rb +30 -47
  4. data/lib/wot_api/exceptions.rb +6 -0
  5. data/lib/wot_api/version.rb +1 -1
  6. data/spec/base_spec.rb +60 -62
  7. data/spec/fixtures/{clan_top.json → success.json} +1 -1
  8. data/spec/spec_helper.rb +12 -15
  9. data/wot_api.gemspec +2 -2
  10. metadata +13 -95
  11. data/spec/fixtures/account_achievements.json +0 -12
  12. data/spec/fixtures/account_info.json +0 -13
  13. data/spec/fixtures/account_list.json +0 -13
  14. data/spec/fixtures/account_tanks.json +0 -13
  15. data/spec/fixtures/clan_info.json +0 -13
  16. data/spec/fixtures/clan_list.json +0 -13
  17. data/spec/fixtures/clan_membersinfo.json +0 -12
  18. data/spec/fixtures/clan_provinces.json +0 -12
  19. data/spec/fixtures/clanratings_clans.json +0 -12
  20. data/spec/fixtures/clanratings_dates.json +0 -12
  21. data/spec/fixtures/clanratings_neighbors.json +0 -12
  22. data/spec/fixtures/clanratings_top.json +0 -13
  23. data/spec/fixtures/clanratings_types.json +0 -13
  24. data/spec/fixtures/encyclopedia_achievements.json +0 -13
  25. data/spec/fixtures/encyclopedia_arenas.json +0 -13
  26. data/spec/fixtures/encyclopedia_info.json +0 -13
  27. data/spec/fixtures/encyclopedia_tankchassis.json +0 -13
  28. data/spec/fixtures/encyclopedia_tankengines.json +0 -13
  29. data/spec/fixtures/encyclopedia_tankguns.json +0 -13
  30. data/spec/fixtures/encyclopedia_tankinfo.json +0 -13
  31. data/spec/fixtures/encyclopedia_tankradios.json +0 -13
  32. data/spec/fixtures/encyclopedia_tanks.json +0 -13
  33. data/spec/fixtures/encyclopedia_tankturrets.json +0 -13
  34. data/spec/fixtures/endpoints.yml +0 -80
  35. data/spec/fixtures/globalwar_alleyoffame.json +0 -12
  36. data/spec/fixtures/globalwar_battles.json +0 -12
  37. data/spec/fixtures/globalwar_clans.json +0 -13
  38. data/spec/fixtures/globalwar_famepoints.json +0 -12
  39. data/spec/fixtures/globalwar_famepointshistory.json +0 -11
  40. data/spec/fixtures/globalwar_maps.json +0 -12
  41. data/spec/fixtures/globalwar_provinces.json +0 -13
  42. data/spec/fixtures/globalwar_top.json +0 -13
  43. data/spec/fixtures/globalwar_tournaments.json +0 -12
  44. data/spec/fixtures/globalwar_victorypointshistory.json +0 -12
  45. data/spec/fixtures/ratings_accounts.json +0 -13
  46. data/spec/fixtures/ratings_dates.json +0 -12
  47. data/spec/fixtures/ratings_neighbors.json +0 -13
  48. data/spec/fixtures/ratings_top.json +0 -13
  49. data/spec/fixtures/ratings_types.json +0 -13
  50. data/spec/fixtures/tanks_achievements.json +0 -13
  51. data/spec/fixtures/tanks_stats.json +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3687dac762b83c0bdd715518c0c8ec9db4115fe7
4
- data.tar.gz: dc8f1d1812689cb7f8394b7fa500134dfedf2bd4
3
+ metadata.gz: f1fde6a4c40567dfc6ea8e99dc1ee523a6679c4c
4
+ data.tar.gz: 2bf93cb39e4d3cf24136ef4803464da523e9b05c
5
5
  SHA512:
6
- metadata.gz: 9cae4fb5fecb1cc2a66cc90a961a849a55b911816da130d7a9baa46093f9b65cefb1a7997bd9ce169e81e241bb2232db02086bb85988abc713ca3e61c906820e
7
- data.tar.gz: 34875015ac1df5e62a521a3c4faaad4fd37283fd1c2e08fd1f29b3758b62036ecef2904bf1044749d7556e8909a5c6fc22f3dcfff60ba7e8f2571c20bd60a9f0
6
+ metadata.gz: d42151882278a2dcad9ba63d810f7d34d3901eaf8d2668179b57bdcc8fb4a380d09701d301f32f5996e772293ff8dddde002ecd5e36a3854a9de2c785be50e6b
7
+ data.tar.gz: aa61846e095267d40cd6ec8d79a464fa52cc064dc277af7f4656677cf652a66adc1263bffab0c8dba3add74bca04ec52fb702552f5dc3145b277d152ab827908
data/README.md CHANGED
@@ -4,6 +4,8 @@ API wrapper for World of Tanks in Ruby
4
4
 
5
5
  [![Build Status](https://travis-ci.org/jcantara/wot_api.svg?branch=master)](https://travis-ci.org/jcantara/wot_api)
6
6
 
7
+ [![Coverage Status](https://coveralls.io/repos/jcantara/wot_api/badge.png)](https://coveralls.io/r/jcantara/wot_api)
8
+
7
9
  ## Installation
8
10
 
9
11
  Add this line to your application's Gemfile:
data/lib/wot_api/base.rb CHANGED
@@ -5,49 +5,6 @@ module WotApi
5
5
  class Base
6
6
  include HTTParty
7
7
 
8
- ENDPOINTS = [
9
- '/wot/account/list/',
10
- '/wot/account/info/',
11
- '/wot/account/tanks/',
12
- '/wot/account/achievements/',
13
- '/wot/clan/list/',
14
- '/wot/clan/info/',
15
- '/wot/clan/top/',
16
- '/wot/clan/provinces/',
17
- '/wot/clan/membersinfo/',
18
- '/wot/globalwar/clans/',
19
- '/wot/globalwar/famepoints/',
20
- '/wot/globalwar/maps/',
21
- '/wot/globalwar/provinces/',
22
- '/wot/globalwar/top/',
23
- '/wot/globalwar/tournaments/',
24
- '/wot/globalwar/alleyoffame/',
25
- '/wot/globalwar/battles/',
26
- '/wot/globalwar/victorypointshistory/',
27
- '/wot/encyclopedia/tanks/',
28
- '/wot/encyclopedia/tankinfo/',
29
- '/wot/encyclopedia/tankengines/',
30
- '/wot/encyclopedia/tankturrets/',
31
- '/wot/encyclopedia/tankradios/',
32
- '/wot/encyclopedia/tankchassis/',
33
- '/wot/encyclopedia/tankguns/',
34
- '/wot/encyclopedia/achievements/',
35
- '/wot/encyclopedia/info/',
36
- '/wot/encyclopedia/arenas/',
37
- '/wot/ratings/types/',
38
- '/wot/ratings/dates/',
39
- '/wot/ratings/accounts/',
40
- '/wot/ratings/neighbors/',
41
- '/wot/ratings/top/',
42
- '/wot/clanratings/types/',
43
- '/wot/clanratings/dates/',
44
- '/wot/clanratings/clans/',
45
- '/wot/clanratings/neighbors/',
46
- '/wot/clanratings/top/',
47
- '/wot/tanks/stats/',
48
- '/wot/tanks/achievements/'
49
- ]
50
-
51
8
  REGIONS = {
52
9
  na: 'https://api.worldoftanks.com',
53
10
  ru: 'https://api.worldoftanks.ru',
@@ -56,6 +13,14 @@ module WotApi
56
13
  kr: 'https://api.worldoftanks.kr'
57
14
  }
58
15
 
16
+ REGIONS2 = {
17
+ na: 'http://na.wargaming.net',
18
+ ru: 'http://ru.wargaming.net',
19
+ eu: 'http://eu.wargaming.net',
20
+ asia: 'http://asia.wargaming.net',
21
+ kr: 'http://kr.wargaming.net',
22
+ }
23
+
59
24
  class << self
60
25
  attr_reader :configuration
61
26
  attr_reader :default_region
@@ -75,11 +40,26 @@ module WotApi
75
40
  end
76
41
  end
77
42
 
43
+ def clans_accounts(params)
44
+ params ||= {}
45
+ raise WotApi::InvalidArguments unless params[:clan_id]
46
+ if region = params.delete(:region).to_sym rescue nil
47
+ base_uri = REGIONS2[region]
48
+ else
49
+ base_uri = REGIONS2[@default_region]
50
+ end
51
+ raise WotApi::InvalidRegionError unless base_uri
52
+ self.base_uri base_uri
53
+ response = WotApi::Base.get("/clans/#{params[:clan_id]}/accounts", headers: {"X-Requested-With"=> "XMLHttpRequest"})
54
+ JSON.parse(response||"{}")['items']
55
+ end
56
+
78
57
  def pathname(path)
79
58
  path.gsub(/(\/)+$/,'').gsub('/wot/','').gsub('/', '_')
80
59
  end
81
60
 
82
61
  def merged_params(params)
62
+ params ||= {}
83
63
  raise WotApi::InvalidConfigError unless @configuration.class == Hash
84
64
  if region = params.delete(:region).to_sym rescue nil
85
65
  config = @configuration[region]
@@ -97,12 +77,13 @@ module WotApi
97
77
  WotApi::Base.post(endpoint, body: merged_params(params))
98
78
  end
99
79
 
100
- ENDPOINTS.each do |endpoint|
101
- define_method WotApi::Base.pathname(endpoint) do |params = {}|
80
+ def method_missing(method_sym, *arguments, &block)
81
+ if !self.methods.include?(method_sym) && method_sym.to_s =~ /^([^_]*)_([^_]*)$/
82
+ endpoint = "/wot/" + method_sym.to_s.gsub('_','/') + "/"
102
83
  begin
103
- response = merged_post(endpoint, params)
84
+ response = merged_post(endpoint, arguments.first)
104
85
  rescue
105
- raise
86
+ raise WotApi::ConnectionError
106
87
  end
107
88
  if response && response['data']
108
89
  return response['data']
@@ -111,6 +92,8 @@ module WotApi
111
92
  message = response['error']['message'] if response && response['error'] && response['error']['message']
112
93
  raise WotApi::ResponseError, message
113
94
  end
95
+ else
96
+ super
114
97
  end
115
98
  end
116
99
  end
@@ -6,10 +6,16 @@ module WotApi
6
6
  class ResponseError < Error
7
7
  end
8
8
 
9
+ class ConnectionError < Error
10
+ end
11
+
9
12
  class InvalidRegionError < Error
10
13
  end
11
14
 
12
15
  class InvalidConfigError < Error
13
16
  end
14
17
 
18
+ class InvalidArguments < Error
19
+ end
20
+
15
21
  end
@@ -1,3 +1,3 @@
1
1
  module WotApi
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
data/spec/base_spec.rb CHANGED
@@ -11,35 +11,50 @@ describe WotApi::Base do
11
11
  expect(WotApi::Base.new).to be_a_kind_of(HTTParty)
12
12
  end
13
13
 
14
- describe "ENDPOINTS" do
15
- WotApi::Base::ENDPOINTS.each do |endpoint|
16
- describe "#{endpoint}" do
17
- it "starts and ends with a slash" do
18
- expect(endpoint[0]).to eq '/'
19
- expect(endpoint[-1]).to eq '/'
14
+ describe "REGIONS" do
15
+ WotApi::Base::REGIONS.each do |region, url|
16
+ describe "#{region}" do
17
+ it "has a sym region key" do
18
+ expect(region).to be_a Symbol
19
+ end
20
+
21
+ it "has a string value" do
22
+ expect(url).to be_a String
23
+ end
24
+
25
+ it "uses https" do
26
+ expect(URI.parse(url).scheme).to eq 'https'
20
27
  end
21
28
  end
22
29
  end
23
30
  end
24
31
 
25
- describe "REGIONS" do
26
- WotApi::Base::REGIONS.each do |region|
32
+ describe "REGIONS2" do
33
+ WotApi::Base::REGIONS2.each do |region, url|
27
34
  describe "#{region}" do
28
35
  it "has a sym region key" do
29
- expect(region[0]).to be_a Symbol
36
+ expect(region).to be_a Symbol
30
37
  end
31
38
 
32
39
  it "has a string value" do
33
- expect(region[1]).to be_a String
40
+ expect(url).to be_a String
34
41
  end
35
42
 
36
- it "has a https URL value" do
37
- expect(URI.parse(region[1]).scheme).to eq 'https'
43
+ it "uses http" do
44
+ expect(URI.parse(url).scheme).to eq 'http'
38
45
  end
39
46
  end
40
47
  end
41
48
  end
42
49
 
50
+ describe ".clans_accounts" do
51
+ it "calls WotApi::Base.get with endpoint and clan_id" do
52
+ WotApi::Base.config({'na' => '123456'})
53
+ expect(WotApi::Base).to receive(:get).with("/clans/12345/accounts", headers: {"X-Requested-With"=> "XMLHttpRequest"})
54
+ WotApi::Base.clans_accounts(clan_id: "12345")
55
+ end
56
+ end
57
+
43
58
  describe ".merged_post" do
44
59
  it "calls WotApi::Base.post with endpont and merged_params output" do
45
60
  params1 = {random: 'hash'}
@@ -78,14 +93,6 @@ describe WotApi::Base do
78
93
  end
79
94
  end
80
95
 
81
- describe ".pathname" do
82
- it "removes 'wot' and changes slashes to underscores" do
83
- expect(WotApi::Base.pathname('/wot/thing/stuff')).to eq "thing_stuff"
84
- expect(WotApi::Base.pathname('api/endpoint')).to eq "api_endpoint"
85
- expect(WotApi::Base.pathname('/wot/blah/path/')).to eq 'blah_path'
86
- end
87
- end
88
-
89
96
  describe ".merged_params" do
90
97
  context "with a valid region parameter" do
91
98
  it "merges the params hash argument with the application_id from the specified region" do
@@ -122,54 +129,45 @@ describe WotApi::Base do
122
129
  end
123
130
  end
124
131
 
125
- describe "dynamic endpoint class methods" do
126
- WotApi::Base::ENDPOINTS.each do |endpoint|
127
- method_name = WotApi::Base.pathname(endpoint)
128
- describe ".#{method_name}" do
129
- before(:example) do
130
- WotApi::Base.config({na: '123456'})
131
- end
132
-
133
- it "creates a method named #{method_name}" do
134
- expect(WotApi::Base.respond_to?(method_name.to_sym)).to eq true
135
- end
132
+ describe "endpoint methods via method_missing" do
133
+ before(:example) do
134
+ WotApi::Base.config({na: '123456'})
135
+ end
136
136
 
137
- it "posts to the endpoint #{endpoint}" do
138
- expect(WotApi::Base).to receive(:post).and_return({'data' => true})
139
- WotApi::Base.send(method_name.to_sym)
140
- end
137
+ it "posts to the specified endpoint" do
138
+ expect(WotApi::Base).to receive(:post).with("/wot/thing/stuff/", kind_of(Hash)).and_return({'data' => true})
139
+ WotApi::Base.thing_stuff(a: 'test')
140
+ end
141
141
 
142
- it "accepts a hash of arguments to post to the endpoint and merges them with the application_id" do
143
- arguments = {a: 'hi', b: 'test', c: 3}
144
- expect(WotApi::Base).to receive(:post).with(endpoint, body: arguments.merge(application_id: '123456')).and_return({'data' => true})
145
- WotApi::Base.send(method_name.to_sym, arguments)
146
- end
142
+ it "accepts a hash of arguments to post to the endpoint and merges them with the application_id" do
143
+ arguments = {a: 'hi', b: 'test', c: 3}
144
+ expect(WotApi::Base).to receive(:post).with("/wot/thing/stuff/", body: arguments.merge(application_id: '123456')).and_return({'data' => true})
145
+ WotApi::Base.thing_stuff(arguments)
146
+ end
147
147
 
148
- context "with a valid response" do
149
- it "receives a response from api with data in an Array or Hash" do
150
- FakeWeb.register_uri(:post, "#{WotApi::Base.base_uri}#{endpoint}", :response => File.join(File.dirname(__FILE__), 'fixtures', "#{method_name}.json"))
151
- expect(WotApi::Base.send(method_name.to_sym)).to be_a_kind_of(Array).or be_a_kind_of(Hash)
152
- end
153
- end
148
+ context "with a valid response" do
149
+ it "receives a response from api with data in an Array or Hash" do
150
+ FakeWeb.register_uri(:post, "#{WotApi::Base.base_uri}/wot/thing/stuff/", :response => File.join(File.dirname(__FILE__), 'fixtures', "success.json"))
151
+ expect(WotApi::Base.thing_stuff).to be_a_kind_of(Array)
152
+ end
153
+ end
154
154
 
155
- context "with an invalid response" do
156
- it "raises an exception" do
157
- FakeWeb.register_uri(:post, "#{WotApi::Base.base_uri}#{endpoint}", :response => File.join(File.dirname(__FILE__), 'fixtures', "error.json"))
158
- expect{WotApi::Base.send(method_name.to_sym)}.to raise_error
159
- end
155
+ context "with an invalid response" do
156
+ it "raises an exception" do
157
+ FakeWeb.register_uri(:post, "#{WotApi::Base.base_uri}/wot/thing/stuff/", :response => File.join(File.dirname(__FILE__), 'fixtures', "error.json"))
158
+ expect{WotApi::Base.thing_stuff}.to raise_error(WotApi::ResponseError)
159
+ end
160
160
 
161
- it "includes the error message from WoT in the exception" do
162
- FakeWeb.register_uri(:post, "#{WotApi::Base.base_uri}#{endpoint}", :response => File.join(File.dirname(__FILE__), 'fixtures', "error.json"))
163
- expect{WotApi::Base.send(method_name.to_sym)}.to raise_error('APPLICATION_ID_NOT_SPECIFIED')
164
- end
165
- end
161
+ it "includes the error message from WoT in the exception" do
162
+ FakeWeb.register_uri(:post, "#{WotApi::Base.base_uri}/wot/thing/stuff/", :response => File.join(File.dirname(__FILE__), 'fixtures', "error.json"))
163
+ expect{WotApi::Base.thing_stuff}.to raise_error(WotApi::ResponseError, 'APPLICATION_ID_NOT_SPECIFIED')
164
+ end
165
+ end
166
166
 
167
- context "with httparty exception" do
168
- it "reraises the httparty exception" do
169
- allow(WotApi::Base).to receive(:post).and_raise(HTTParty::Error)
170
- expect{WotApi::Base.send(method_name.to_sym)}.to raise_error(HTTParty::Error)
171
- end
172
- end
167
+ context "with an invalid endpoint" do
168
+ it "raises connection exception" do
169
+ allow(WotApi::Base).to receive(:post).and_raise(HTTParty::Error)
170
+ expect{WotApi::Base.thing_fake}.to raise_error(WotApi::ConnectionError)
173
171
  end
174
172
  end
175
173
  end
@@ -9,4 +9,4 @@ Content-Language: en
9
9
  Access-Control-Request-Method: GET, POST
10
10
  Access-Control-Allow-Origin: *
11
11
 
12
- {"status":"ok","count":0,"data":[]}
12
+ {"status":"ok","count":0,"data":[]}
data/spec/spec_helper.rb CHANGED
@@ -1,21 +1,18 @@
1
- require 'simplecov'
2
- SimpleCov.start do
3
- add_filter '/spec/'
1
+ require 'coveralls'
2
+ Coveralls.wear!
4
3
 
5
- require 'bundler/setup'
6
- Bundler.setup
4
+ require 'bundler/setup'
5
+ Bundler.setup
7
6
 
8
- require 'fakeweb'
9
- FakeWeb.allow_net_connect = false
7
+ require 'fakeweb'
8
+ FakeWeb.allow_net_connect = %r[^https?://coveralls.io]
10
9
 
11
- require 'wot_api'
10
+ require 'wot_api'
12
11
 
13
- RSpec.configure do |config|
14
- config.treat_symbols_as_metadata_keys_with_true_values = true
15
- config.run_all_when_everything_filtered = true
16
- config.filter_run :focus
17
-
18
- config.order = 'random'
19
- end
12
+ RSpec.configure do |config|
13
+ config.treat_symbols_as_metadata_keys_with_true_values = true
14
+ config.run_all_when_everything_filtered = true
15
+ config.filter_run :focus
20
16
 
17
+ config.order = 'random'
21
18
  end
data/wot_api.gemspec CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.6"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec", "3.0.0.rc1"
23
+ spec.add_development_dependency "rspec", "~> 3.3.0"
24
24
  spec.add_development_dependency "fakeweb", "~> 1.3"
25
- spec.add_development_dependency 'simplecov', '~> 0.7.1'
25
+ spec.add_development_dependency "coveralls"
26
26
 
27
27
  spec.add_runtime_dependency "httparty", "~> 0.13"
28
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wot_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Cantara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2015-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.0.rc1
47
+ version: 3.3.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.0.rc1
54
+ version: 3.3.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: fakeweb
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
- name: simplecov
70
+ name: coveralls
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.7.1
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.7.1
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: httparty
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -113,49 +113,8 @@ files:
113
113
  - lib/wot_api/exceptions.rb
114
114
  - lib/wot_api/version.rb
115
115
  - spec/base_spec.rb
116
- - spec/fixtures/account_achievements.json
117
- - spec/fixtures/account_info.json
118
- - spec/fixtures/account_list.json
119
- - spec/fixtures/account_tanks.json
120
- - spec/fixtures/clan_info.json
121
- - spec/fixtures/clan_list.json
122
- - spec/fixtures/clan_membersinfo.json
123
- - spec/fixtures/clan_provinces.json
124
- - spec/fixtures/clan_top.json
125
- - spec/fixtures/clanratings_clans.json
126
- - spec/fixtures/clanratings_dates.json
127
- - spec/fixtures/clanratings_neighbors.json
128
- - spec/fixtures/clanratings_top.json
129
- - spec/fixtures/clanratings_types.json
130
- - spec/fixtures/encyclopedia_achievements.json
131
- - spec/fixtures/encyclopedia_arenas.json
132
- - spec/fixtures/encyclopedia_info.json
133
- - spec/fixtures/encyclopedia_tankchassis.json
134
- - spec/fixtures/encyclopedia_tankengines.json
135
- - spec/fixtures/encyclopedia_tankguns.json
136
- - spec/fixtures/encyclopedia_tankinfo.json
137
- - spec/fixtures/encyclopedia_tankradios.json
138
- - spec/fixtures/encyclopedia_tanks.json
139
- - spec/fixtures/encyclopedia_tankturrets.json
140
- - spec/fixtures/endpoints.yml
141
116
  - spec/fixtures/error.json
142
- - spec/fixtures/globalwar_alleyoffame.json
143
- - spec/fixtures/globalwar_battles.json
144
- - spec/fixtures/globalwar_clans.json
145
- - spec/fixtures/globalwar_famepoints.json
146
- - spec/fixtures/globalwar_famepointshistory.json
147
- - spec/fixtures/globalwar_maps.json
148
- - spec/fixtures/globalwar_provinces.json
149
- - spec/fixtures/globalwar_top.json
150
- - spec/fixtures/globalwar_tournaments.json
151
- - spec/fixtures/globalwar_victorypointshistory.json
152
- - spec/fixtures/ratings_accounts.json
153
- - spec/fixtures/ratings_dates.json
154
- - spec/fixtures/ratings_neighbors.json
155
- - spec/fixtures/ratings_top.json
156
- - spec/fixtures/ratings_types.json
157
- - spec/fixtures/tanks_achievements.json
158
- - spec/fixtures/tanks_stats.json
117
+ - spec/fixtures/success.json
159
118
  - spec/spec_helper.rb
160
119
  - wot_api.gemspec
161
120
  homepage: https://github.com/jcantara/wot_api
@@ -185,47 +144,6 @@ specification_version: 4
185
144
  summary: API wrapper for 'World of Tanks'.
186
145
  test_files:
187
146
  - spec/base_spec.rb
188
- - spec/fixtures/account_achievements.json
189
- - spec/fixtures/account_info.json
190
- - spec/fixtures/account_list.json
191
- - spec/fixtures/account_tanks.json
192
- - spec/fixtures/clan_info.json
193
- - spec/fixtures/clan_list.json
194
- - spec/fixtures/clan_membersinfo.json
195
- - spec/fixtures/clan_provinces.json
196
- - spec/fixtures/clan_top.json
197
- - spec/fixtures/clanratings_clans.json
198
- - spec/fixtures/clanratings_dates.json
199
- - spec/fixtures/clanratings_neighbors.json
200
- - spec/fixtures/clanratings_top.json
201
- - spec/fixtures/clanratings_types.json
202
- - spec/fixtures/encyclopedia_achievements.json
203
- - spec/fixtures/encyclopedia_arenas.json
204
- - spec/fixtures/encyclopedia_info.json
205
- - spec/fixtures/encyclopedia_tankchassis.json
206
- - spec/fixtures/encyclopedia_tankengines.json
207
- - spec/fixtures/encyclopedia_tankguns.json
208
- - spec/fixtures/encyclopedia_tankinfo.json
209
- - spec/fixtures/encyclopedia_tankradios.json
210
- - spec/fixtures/encyclopedia_tanks.json
211
- - spec/fixtures/encyclopedia_tankturrets.json
212
- - spec/fixtures/endpoints.yml
213
147
  - spec/fixtures/error.json
214
- - spec/fixtures/globalwar_alleyoffame.json
215
- - spec/fixtures/globalwar_battles.json
216
- - spec/fixtures/globalwar_clans.json
217
- - spec/fixtures/globalwar_famepoints.json
218
- - spec/fixtures/globalwar_famepointshistory.json
219
- - spec/fixtures/globalwar_maps.json
220
- - spec/fixtures/globalwar_provinces.json
221
- - spec/fixtures/globalwar_top.json
222
- - spec/fixtures/globalwar_tournaments.json
223
- - spec/fixtures/globalwar_victorypointshistory.json
224
- - spec/fixtures/ratings_accounts.json
225
- - spec/fixtures/ratings_dates.json
226
- - spec/fixtures/ratings_neighbors.json
227
- - spec/fixtures/ratings_top.json
228
- - spec/fixtures/ratings_types.json
229
- - spec/fixtures/tanks_achievements.json
230
- - spec/fixtures/tanks_stats.json
148
+ - spec/fixtures/success.json
231
149
  - spec/spec_helper.rb
@@ -1,12 +0,0 @@
1
- HTTP/1.1 200 OK
2
- Server: nginx
3
- Date: Thu, 20 Nov 2014 21:26:01 GMT
4
- Content-Type: application/json; charset=utf-8
5
- Content-Length: 428
6
- Connection: keep-alive
7
- X-Api-Version: 2.15.2
8
- Content-Language: en
9
- Access-Control-Request-Method: GET, POST
10
- Access-Control-Allow-Origin: *
11
-
12
- {"status":"ok","count":1,"data":{"1001407449":{"achievements":{"titleSniper":15,"medalCarius":3,"invader":1,"medalLavrinenko":4,"armorPiercer":10,"medalPoppel":4,"medalKnispel":4,"medalKay":4,"medalAbrams":3,"medalLeClerc":3,"supporter":1},"frags":{"beasthunter":0,"sinai":0,"pattonValley":0},"max_series":{"armorPiercer":10,"titleSniper":15,"deathTrack":0,"invincible":2,"tacticalBreakthrough":0,"diehard":5,"handOfDeath":2}}}}
@@ -1,13 +0,0 @@
1
- HTTP/1.1 200 OK
2
- Server: nginx
3
- Date: Thu, 20 Nov 2014 21:25:59 GMT
4
- Content-Type: application/json; charset=utf-8
5
- Content-Length: 2544
6
- Connection: keep-alive
7
- Vary: Accept-Encoding
8
- X-Api-Version: 2.15.2
9
- Content-Language: en
10
- Access-Control-Request-Method: GET, POST
11
- Access-Control-Allow-Origin: *
12
-
13
- {"status":"ok","count":1,"data":{"1001407449":{"achievements":null,"client_language":"en","statistics":{"clan":{"spotted":0,"avg_damage_assisted_track":0.0,"avg_damage_blocked":0.0,"direct_hits_received":0,"explosion_hits":0,"piercings_received":0,"piercings":0,"xp":0,"survived_battles":0,"hits_percents":0,"draws":0,"battles":0,"damage_received":0,"avg_damage_assisted":0.0,"frags":0,"dropped_capture_points":0,"avg_damage_assisted_radio":0.0,"capture_points":0,"base_xp":0,"hits":0,"battle_avg_xp":0,"wins":0,"losses":0,"damage_dealt":0,"no_damage_direct_hits_received":0,"shots":0,"explosion_hits_received":0,"tanking_factor":0.0},"all":{"spotted":117,"avg_damage_assisted_track":0.0,"avg_damage_blocked":0.0,"direct_hits_received":22,"explosion_hits":0,"piercings_received":21,"piercings":49,"xp":53177,"survived_battles":107,"hits_percents":31,"draws":6,"battles":317,"damage_received":35285,"avg_damage_assisted":0.0,"frags":230,"dropped_capture_points":156,"avg_damage_assisted_radio":0.0,"capture_points":734,"base_xp":2918,"hits":1755,"battle_avg_xp":168,"wins":164,"losses":147,"damage_dealt":53840,"no_damage_direct_hits_received":1,"shots":5712,"explosion_hits_received":1,"tanking_factor":0.0},"max_xp":772,"company":{"spotted":0,"avg_damage_assisted_track":0.0,"avg_damage_blocked":0.0,"direct_hits_received":0,"explosion_hits":0,"piercings_received":0,"piercings":0,"xp":0,"survived_battles":0,"hits_percents":0,"draws":0,"battles":0,"damage_received":0,"avg_damage_assisted":0.0,"frags":0,"dropped_capture_points":0,"avg_damage_assisted_radio":0.0,"capture_points":0,"base_xp":0,"hits":0,"battle_avg_xp":0,"wins":0,"losses":0,"damage_dealt":0,"no_damage_direct_hits_received":0,"shots":0,"explosion_hits_received":0,"tanking_factor":0.0},"historical":{"spotted":0,"avg_damage_assisted_track":0.0,"avg_damage_blocked":0.0,"direct_hits_received":0,"explosion_hits":0,"piercings_received":0,"piercings":0,"xp":0,"survived_battles":0,"hits_percents":0,"draws":0,"battles":0,"damage_received":0,"avg_damage_assisted":0.0,"frags":0,"dropped_capture_points":0,"avg_damage_assisted_radio":0.0,"capture_points":0,"base_xp":0,"hits":0,"battle_avg_xp":0,"wins":0,"losses":0,"damage_dealt":0,"no_damage_direct_hits_received":0,"shots":0,"explosion_hits_received":0,"tanking_factor":0.0},"frags":null,"max_damage":817,"max_damage_vehicle":6913},"account_id":1001407449,"last_battle_time":1384025959,"clan_id":null,"created_at":1318942098,"updated_at":1416345010,"private":null,"global_rating":2534,"logout_at":1384025997,"nickname":"abc"}}}
@@ -1,13 +0,0 @@
1
- HTTP/1.1 200 OK
2
- Server: nginx
3
- Date: Thu, 20 Nov 2014 21:25:58 GMT
4
- Content-Type: application/json; charset=utf-8
5
- Content-Length: 6050
6
- Connection: keep-alive
7
- Vary: Accept-Encoding
8
- X-Api-Version: 2.15.2
9
- Content-Language: en
10
- Access-Control-Request-Method: GET, POST
11
- Access-Control-Allow-Origin: *
12
-
13
- {"status":"ok","count":100,"data":[{"nickname":"abc","id":null,"account_id":1001407449},{"nickname":"abc0","id":null,"account_id":1008406637},{"nickname":"abc0001abc","id":null,"account_id":1006760438},{"nickname":"abc001","id":null,"account_id":1004003899},{"nickname":"abc002","id":null,"account_id":1004017871},{"nickname":"Abc007","id":null,"account_id":1000851929},{"nickname":"abc01","id":null,"account_id":1001521332},{"nickname":"ABC0101","id":null,"account_id":1007359255},{"nickname":"abc0123456789","id":null,"account_id":1004737214},{"nickname":"abc01_hero","id":null,"account_id":1005882335},{"nickname":"abc021011","id":null,"account_id":1004698075},{"nickname":"abc0212","id":null,"account_id":1008540658},{"nickname":"abc028677","id":null,"account_id":1002888750},{"nickname":"abc0401222","id":null,"account_id":1005086728},{"nickname":"abc0815","id":null,"account_id":1000001452},{"nickname":"abc0921777","id":null,"account_id":1000990900},{"nickname":"abc0925480914","id":null,"account_id":1006923138},{"nickname":"abc1","id":null,"account_id":1000774322},{"nickname":"abc10","id":null,"account_id":1001055595},{"nickname":"abc100","id":null,"account_id":1002883000},{"nickname":"abc101","id":null,"account_id":1001423554},{"nickname":"abc10227","id":null,"account_id":1002101666},{"nickname":"abc1046477589","id":null,"account_id":1004707581},{"nickname":"abc11","id":null,"account_id":1007227104},{"nickname":"abc112","id":null,"account_id":1006480463},{"nickname":"abc12","id":null,"account_id":1001739372},{"nickname":"abc12123","id":null,"account_id":1002396288},{"nickname":"abc1212a","id":null,"account_id":1003448735},{"nickname":"abc1212c","id":null,"account_id":1003448741},{"nickname":"abc12132","id":null,"account_id":1001058418},{"nickname":"abc122173","id":null,"account_id":1001331892},{"nickname":"abc1225576485","id":null,"account_id":1005704013},{"nickname":"abc123","id":null,"account_id":1000021539},{"nickname":"abc1231","id":null,"account_id":1007330932},{"nickname":"abc123123","id":null,"account_id":1001759047},{"nickname":"abc123159","id":null,"account_id":1001072237},{"nickname":"abc1233","id":null,"account_id":1000857910},{"nickname":"abc123321","id":null,"account_id":1001834078},{"nickname":"abc12333","id":null,"account_id":1004352243},{"nickname":"abc1234","id":null,"account_id":1000333385},{"nickname":"abc123411","id":null,"account_id":1008007667},{"nickname":"abc123415","id":null,"account_id":1001540102},{"nickname":"abc123423","id":null,"account_id":1002283921},{"nickname":"abc1234321","id":null,"account_id":1001426960},{"nickname":"abc12344555","id":null,"account_id":1003047292},{"nickname":"abc12345","id":null,"account_id":1000402976},{"nickname":"abc123456","id":null,"account_id":1000349983},{"nickname":"abc1234566","id":null,"account_id":1004398552},{"nickname":"abc1234567","id":null,"account_id":1001422669},{"nickname":"ABC12345678","id":null,"account_id":1006753637},{"nickname":"abc123456789","id":null,"account_id":1000888288},{"nickname":"abc1234567890","id":null,"account_id":1001091387},{"nickname":"abc1234567891010","id":null,"account_id":1006139726},{"nickname":"abc123456789101112131416","id":null,"account_id":1001002646},{"nickname":"abc12345678987654321","id":null,"account_id":1006832140},{"nickname":"abc123456_1","id":null,"account_id":1005791028},{"nickname":"Abc123456__","id":null,"account_id":1005974563},{"nickname":"abc123456def_hero","id":null,"account_id":1005748341},{"nickname":"abc12345_2013","id":null,"account_id":1005716676},{"nickname":"abc12345_destroyer","id":null,"account_id":1006828186},{"nickname":"abc12345abc","id":null,"account_id":1007179317},{"nickname":"abc12345abc6","id":null,"account_id":1007179505},{"nickname":"abc12345abc7","id":null,"account_id":1007179526},{"nickname":"abc12345d","id":null,"account_id":1003141813},{"nickname":"abc1234d","id":null,"account_id":1003090973},{"nickname":"abc1237706","id":null,"account_id":1007357565},{"nickname":"ABC123789","id":null,"account_id":1002646856},{"nickname":"abc12389","id":null,"account_id":1004207401},{"nickname":"abc123abc","id":null,"account_id":1000629261},{"nickname":"abc123abc123","id":null,"account_id":1002009935},{"nickname":"abc123abc300","id":null,"account_id":1005991782},{"nickname":"abc123abc321","id":null,"account_id":1001318220},{"nickname":"ABC123ACB","id":null,"account_id":1002935279},{"nickname":"abc123aj","id":null,"account_id":1000809383},{"nickname":"abc123BBUNME","id":null,"account_id":1000796459},{"nickname":"abc123bds","id":null,"account_id":1004298830},{"nickname":"abc123cba321","id":null,"account_id":1005876228},{"nickname":"ABC123DARKNE55","id":null,"account_id":1002588845},{"nickname":"abc123def","id":null,"account_id":1007840029},{"nickname":"abc123def456","id":null,"account_id":1001015965},{"nickname":"abc123def456ghi789","id":null,"account_id":1001046074},{"nickname":"abc123def456ghi789jkl","id":null,"account_id":1000466156},{"nickname":"abc123def456ghi789jkl101","id":null,"account_id":1001045166},{"nickname":"abc123dorame","id":null,"account_id":1001134078},{"nickname":"abc123doremi","id":null,"account_id":1005005726},{"nickname":"ABC123Gaming","id":null,"account_id":1005748565},{"nickname":"abc123gilmore","id":null,"account_id":1007720110},{"nickname":"abc123hi","id":null,"account_id":1001173582},{"nickname":"abc123kg","id":null,"account_id":1001602606},{"nickname":"abc123me","id":null,"account_id":1002838740},{"nickname":"abc123mj","id":null,"account_id":1000276408},{"nickname":"abc123mjsong","id":null,"account_id":1001026737},{"nickname":"abc123Noah","id":null,"account_id":1004192118},{"nickname":"abc123nothingwor","id":null,"account_id":1006074010},{"nickname":"Abc123rage","id":null,"account_id":1002847199},{"nickname":"abc123rtdcddv","id":null,"account_id":1000478345},{"nickname":"abc123swag","id":null,"account_id":1007346079},{"nickname":"abc123tank","id":null,"account_id":1002850754},{"nickname":"abc123tw","id":null,"account_id":1005020865},{"nickname":"ABC123twelve","id":null,"account_id":1000461226}]}
@@ -1,13 +0,0 @@
1
- HTTP/1.1 200 OK
2
- Server: nginx
3
- Date: Thu, 20 Nov 2014 21:26:00 GMT
4
- Content-Type: application/json; charset=utf-8
5
- Content-Length: 571
6
- Connection: keep-alive
7
- Vary: Accept-Encoding
8
- X-Api-Version: 2.15.2
9
- Content-Language: en
10
- Access-Control-Request-Method: GET, POST
11
- Access-Control-Allow-Origin: *
12
-
13
- {"status":"ok","count":1,"data":{"1001407449":[{"statistics":{"wins":45,"battles":91},"mark_of_mastery":4,"tank_id":6401},{"statistics":{"wins":33,"battles":72},"mark_of_mastery":3,"tank_id":5121},{"statistics":{"wins":23,"battles":47},"mark_of_mastery":2,"tank_id":6913},{"statistics":{"wins":27,"battles":45},"mark_of_mastery":3,"tank_id":3329},{"statistics":{"wins":17,"battles":36},"mark_of_mastery":1,"tank_id":2065},{"statistics":{"wins":15,"battles":21},"mark_of_mastery":2,"tank_id":3089},{"statistics":{"wins":4,"battles":5},"mark_of_mastery":0,"tank_id":545}]}}
@@ -1,13 +0,0 @@
1
- HTTP/1.1 200 OK
2
- Server: nginx
3
- Date: Thu, 20 Nov 2014 21:26:02 GMT
4
- Content-Type: application/json; charset=utf-8
5
- Content-Length: 1656
6
- Connection: keep-alive
7
- Vary: Accept-Encoding
8
- X-Api-Version: 2.15.2
9
- Content-Language: en
10
- Access-Control-Request-Method: GET, POST
11
- Access-Control-Allow-Origin: *
12
-
13
- {"status":"ok","count":1,"data":{"1000008881":{"request_availability":false,"members_count":3,"name":"Allied Brotherhood Clan","description_html":"<p>We are old and young. We are men and women. We are new players and good players. We are from many countries and talk many languages. We are here to have fun and have a good time.\n<\/p>","color":"#B09CA1","created_at":1365732959,"description":"We are old and young. We are men and women. We are new players and good players. We are from many countries and talk many languages. We are here to have fun and have a good time.","victory_points_step_delta":0,"updated_at":1408301816,"private":null,"abbreviation":"ABC","emblems":{"large":"http:\/\/clans.worldoftanks.com\/media\/clans\/emblems\/cl_881\/1000008881\/emblem_64x64.png","small":"http:\/\/clans.worldoftanks.com\/media\/clans\/emblems\/cl_881\/1000008881\/emblem_24x24.png","medium":"http:\/\/clans.worldoftanks.com\/media\/clans\/emblems\/cl_881\/1000008881\/emblem_32x32.png","bw_tank":"http:\/\/clans.worldoftanks.com\/media\/clans\/emblems\/cl_881\/1000008881\/emblem_64x64_tank.png"},"clan_id":1000008881,"victory_points":0,"members":{"1007891500":{"created_at":1393411070,"role":"diplomat","role_i18n":"Intelligence Officer","account_id":1007891500,"account_name":"Petbark"},"1003584109":{"created_at":1365732959,"role":"leader","role_i18n":"Commander","account_id":1003584109,"account_name":"hetep"},"1003961549":{"created_at":1393455767,"role":"recruit","role_i18n":"Recruit","account_id":1003961549,"account_name":"RageUrFace"}},"is_clan_disbanded":false,"motto":"Pro Libertate","map_id":null,"clan_color":"#FFFFFF","owner_id":1003584109}}}