football_api 0.0.4

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.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +31 -0
  9. data/Rakefile +2 -0
  10. data/football_api-0.0.1.gem +0 -0
  11. data/football_api-0.0.2.gem +0 -0
  12. data/football_api-0.0.3.gem +0 -0
  13. data/football_api.gemspec +36 -0
  14. data/lib/football_api/base_request.rb +75 -0
  15. data/lib/football_api/card.rb +19 -0
  16. data/lib/football_api/comment.rb +13 -0
  17. data/lib/football_api/commentary.rb +79 -0
  18. data/lib/football_api/competition.rb +54 -0
  19. data/lib/football_api/errors.rb +13 -0
  20. data/lib/football_api/event.rb +19 -0
  21. data/lib/football_api/fixture.rb +44 -0
  22. data/lib/football_api/goal.rb +17 -0
  23. data/lib/football_api/match.rb +59 -0
  24. data/lib/football_api/match_bench.rb +27 -0
  25. data/lib/football_api/match_info.rb +14 -0
  26. data/lib/football_api/match_stats.rb +29 -0
  27. data/lib/football_api/match_substitutions.rb +27 -0
  28. data/lib/football_api/match_summary.rb +39 -0
  29. data/lib/football_api/match_team.rb +22 -0
  30. data/lib/football_api/mixins/requestable.rb +19 -0
  31. data/lib/football_api/mixins/symbolizer.rb +59 -0
  32. data/lib/football_api/player.rb +12 -0
  33. data/lib/football_api/standing.rb +104 -0
  34. data/lib/football_api/version.rb +3 -0
  35. data/lib/football_api.rb +32 -0
  36. data/spec/commentary_spec.rb +112 -0
  37. data/spec/competition_spec.rb +27 -0
  38. data/spec/fixture_spec.rb +90 -0
  39. data/spec/helpers/json_helper.rb +41 -0
  40. data/spec/json/commentaries.json +1967 -0
  41. data/spec/json/competitions.json +23 -0
  42. data/spec/json/fixtures.json +4559 -0
  43. data/spec/json/matches.json +17 -0
  44. data/spec/json/standings.json +719 -0
  45. data/spec/match_spec.rb +25 -0
  46. data/spec/spec_helper.rb +115 -0
  47. data/spec/standing_spec.rb +37 -0
  48. metadata +346 -0
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe FootballApi::Match do
4
+ let(:competition_id) { 1204 }
5
+ let(:response) { JSONHelper::Matches.get(:no_matches_today) }
6
+ let(:uri) {
7
+ "#{@base_url}/api/?APIKey=#{@api_key}&Action=today&comp_id=#{competition_id}"
8
+ }
9
+ before(:each) do
10
+ stub_request(:get, uri)
11
+ .with(headers: @headers)
12
+ .to_return(status: 200, body: response.to_json)
13
+ end
14
+
15
+ let(:request_response) { FootballApi::Match.all_from_competition(competition_id) }
16
+
17
+ # At the moment we don't have api with matches today :(
18
+ # lets test what we have!
19
+ describe '.all_from_competition with no matches' do
20
+ it 'returns_no_matches' do
21
+ expect(request_response).not_to be_nil
22
+ expect(request_response.size).to eq(0)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,115 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ require 'bundler/setup'
20
+ Bundler.setup
21
+
22
+ require 'dotenv'
23
+ Dotenv.load
24
+
25
+
26
+ require 'json'
27
+ require 'webmock/rspec'
28
+ require 'football_api'
29
+ require 'helpers/json_helper'
30
+ require 'pry'
31
+ require 'pry-byebug'
32
+ RSpec.configure do |config|
33
+ # For json loading
34
+ config.include JSONHelper
35
+
36
+ config.before(:each) do
37
+ @base_url = "football-api.com"
38
+ @api_key = ENV['API_KEY']
39
+ @headers = {
40
+ 'Accept'=>'*/*',
41
+ 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
42
+ 'User-Agent'=>'Ruby'
43
+ }
44
+ end
45
+
46
+ # rspec-expectations config goes here. You can use an alternate
47
+ # assertion/expectation library such as wrong or the stdlib/minitest
48
+ # assertions if you prefer.
49
+ config.expect_with :rspec do |expectations|
50
+ # This option will default to `true` in RSpec 4. It makes the `description`
51
+ # and `failure_message` of custom matchers include text for helper methods
52
+ # defined using `chain`, e.g.:
53
+ # be_bigger_than(2).and_smaller_than(4).description
54
+ # # => "be bigger than 2 and smaller than 4"
55
+ # ...rather than:
56
+ # # => "be bigger than 2"
57
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
58
+ end
59
+
60
+ # rspec-mocks config goes here. You can use an alternate test double
61
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
62
+ config.mock_with :rspec do |mocks|
63
+ # Prevents you from mocking or stubbing a method that does not exist on
64
+ # a real object. This is generally recommended, and will default to
65
+ # `true` in RSpec 4.
66
+ mocks.verify_partial_doubles = true
67
+ end
68
+
69
+ # The settings below are suggested to provide a good initial experience
70
+ # with RSpec, but feel free to customize to your heart's content.
71
+
72
+ # These two settings work together to allow you to limit a spec run
73
+ # to individual examples or groups you care about by tagging them with
74
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
75
+ # get run.
76
+ config.filter_run :focus
77
+ config.run_all_when_everything_filtered = true
78
+
79
+ # Limits the available syntax to the non-monkey patched syntax that is
80
+ # recommended. For more details, see:
81
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
82
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
83
+ # config.disable_monkey_patching!
84
+
85
+ # This setting enables warnings. It's recommended, but in some cases may
86
+ # be too noisy due to issues in dependencies.
87
+ config.warnings = true
88
+
89
+ # Many RSpec users commonly either run the entire suite or an individual
90
+ # file, and it's useful to allow more verbose output when running an
91
+ # individual spec file.
92
+ # if config.files_to_run.one?
93
+ # # Use the documentation formatter for detailed output,
94
+ # # unless a formatter has already been configured
95
+ # # (e.g. via a command-line flag).
96
+ # config.default_formatter = 'doc'
97
+ # end
98
+
99
+ # Print the 10 slowest examples and example groups at the
100
+ # end of the spec run, to help surface which specs are running
101
+ # particularly slow.
102
+ # config.profile_examples = 10
103
+
104
+ # Run specs in random order to surface order dependencies. If you find an
105
+ # order dependency and want to debug it, you can fix the order by providing
106
+ # the seed, which is printed after each run.
107
+ # --seed 1234
108
+ config.order = :random
109
+
110
+ # Seed global randomization in this process using the `--seed` CLI option.
111
+ # Setting this allows you to use `--seed` to deterministically reproduce
112
+ # test failures related to randomization by passing the same `--seed` value
113
+ # as the one that triggered the failure.
114
+ Kernel.srand config.seed
115
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe FootballApi::Standing do
4
+ let(:response) { JSONHelper::Standings.get(:default) }
5
+ let(:competition_id) { 1204 }
6
+ let(:uri) {
7
+ "#{@base_url}/api/?APIKey=#{@api_key}&Action=standings&comp_id=#{competition_id}"
8
+ }
9
+ before(:each) do
10
+ stub_request(:get, uri)
11
+ .with(headers: @headers)
12
+ .to_return(status: 200, body: response.to_json)
13
+ end
14
+ let(:request_response) { FootballApi::Standing.all_from_competition(competition_id) }
15
+
16
+ describe '.all_from_competition ' do
17
+
18
+ it 'not_fails' do
19
+ expect(request_response).not_to be_nil
20
+ expect(request_response.size).to eq(20)
21
+ end
22
+
23
+ it 'has_first_standing' do
24
+ standing = request_response.first
25
+
26
+ expect(standing).not_to be_nil
27
+ expect(standing.stand_competition_id.to_i).to eq(competition_id)
28
+ end
29
+
30
+ it 'has_last_standing' do
31
+ standing = request_response.last
32
+
33
+ expect(standing).not_to be_nil
34
+ expect(standing.stand_competition_id.to_i).to eq(competition_id)
35
+ end
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,346 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: football_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Afonso Tsukamoto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: reek
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.3.7
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '1.3'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.3.7
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.20'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 0.20.1
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '0.20'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.20.1
81
+ - !ruby/object:Gem::Dependency
82
+ name: pry
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '0.9'
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 0.9.12
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.9'
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 0.9.12
101
+ - !ruby/object:Gem::Dependency
102
+ name: pry-byebug
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: 2.0.0
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - "~>"
113
+ - !ruby/object:Gem::Version
114
+ version: 2.0.0
115
+ - !ruby/object:Gem::Dependency
116
+ name: rspec
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: '3.2'
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 3.2.0
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.2'
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 3.2.0
135
+ - !ruby/object:Gem::Dependency
136
+ name: webmock
137
+ requirement: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - "~>"
140
+ - !ruby/object:Gem::Version
141
+ version: '1.21'
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 1.21.0
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '1.21'
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: 1.21.0
155
+ - !ruby/object:Gem::Dependency
156
+ name: dotenv
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: 2.0.2
162
+ type: :runtime
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - "~>"
167
+ - !ruby/object:Gem::Version
168
+ version: 2.0.2
169
+ - !ruby/object:Gem::Dependency
170
+ name: activesupport
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - "~>"
174
+ - !ruby/object:Gem::Version
175
+ version: '4.1'
176
+ type: :runtime
177
+ prerelease: false
178
+ version_requirements: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - "~>"
181
+ - !ruby/object:Gem::Version
182
+ version: '4.1'
183
+ - !ruby/object:Gem::Dependency
184
+ name: httparty
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - "~>"
188
+ - !ruby/object:Gem::Version
189
+ version: '0.13'
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: 0.13.0
193
+ type: :runtime
194
+ prerelease: false
195
+ version_requirements: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - "~>"
198
+ - !ruby/object:Gem::Version
199
+ version: '0.13'
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: 0.13.0
203
+ - !ruby/object:Gem::Dependency
204
+ name: colored
205
+ requirement: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - "~>"
208
+ - !ruby/object:Gem::Version
209
+ version: '1.2'
210
+ type: :runtime
211
+ prerelease: false
212
+ version_requirements: !ruby/object:Gem::Requirement
213
+ requirements:
214
+ - - "~>"
215
+ - !ruby/object:Gem::Version
216
+ version: '1.2'
217
+ - !ruby/object:Gem::Dependency
218
+ name: tzinfo
219
+ requirement: !ruby/object:Gem::Requirement
220
+ requirements:
221
+ - - "~>"
222
+ - !ruby/object:Gem::Version
223
+ version: '1.1'
224
+ - - ">="
225
+ - !ruby/object:Gem::Version
226
+ version: 1.1.0
227
+ type: :runtime
228
+ prerelease: false
229
+ version_requirements: !ruby/object:Gem::Requirement
230
+ requirements:
231
+ - - "~>"
232
+ - !ruby/object:Gem::Version
233
+ version: '1.1'
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: 1.1.0
237
+ - !ruby/object:Gem::Dependency
238
+ name: eventmachine
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '1.0'
244
+ - - ">="
245
+ - !ruby/object:Gem::Version
246
+ version: 1.0.3
247
+ type: :runtime
248
+ prerelease: false
249
+ version_requirements: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - "~>"
252
+ - !ruby/object:Gem::Version
253
+ version: '1.0'
254
+ - - ">="
255
+ - !ruby/object:Gem::Version
256
+ version: 1.0.3
257
+ description: " Interface with football-api "
258
+ email:
259
+ - atsukamoto@faber-ventures.com
260
+ executables: []
261
+ extensions: []
262
+ extra_rdoc_files: []
263
+ files:
264
+ - ".gitignore"
265
+ - ".rspec"
266
+ - ".ruby-gemset"
267
+ - ".ruby-version"
268
+ - Gemfile
269
+ - LICENSE.txt
270
+ - README.md
271
+ - Rakefile
272
+ - football_api-0.0.1.gem
273
+ - football_api-0.0.2.gem
274
+ - football_api-0.0.3.gem
275
+ - football_api.gemspec
276
+ - lib/football_api.rb
277
+ - lib/football_api/base_request.rb
278
+ - lib/football_api/card.rb
279
+ - lib/football_api/comment.rb
280
+ - lib/football_api/commentary.rb
281
+ - lib/football_api/competition.rb
282
+ - lib/football_api/errors.rb
283
+ - lib/football_api/event.rb
284
+ - lib/football_api/fixture.rb
285
+ - lib/football_api/goal.rb
286
+ - lib/football_api/match.rb
287
+ - lib/football_api/match_bench.rb
288
+ - lib/football_api/match_info.rb
289
+ - lib/football_api/match_stats.rb
290
+ - lib/football_api/match_substitutions.rb
291
+ - lib/football_api/match_summary.rb
292
+ - lib/football_api/match_team.rb
293
+ - lib/football_api/mixins/requestable.rb
294
+ - lib/football_api/mixins/symbolizer.rb
295
+ - lib/football_api/player.rb
296
+ - lib/football_api/standing.rb
297
+ - lib/football_api/version.rb
298
+ - spec/commentary_spec.rb
299
+ - spec/competition_spec.rb
300
+ - spec/fixture_spec.rb
301
+ - spec/helpers/json_helper.rb
302
+ - spec/json/commentaries.json
303
+ - spec/json/competitions.json
304
+ - spec/json/fixtures.json
305
+ - spec/json/matches.json
306
+ - spec/json/standings.json
307
+ - spec/match_spec.rb
308
+ - spec/spec_helper.rb
309
+ - spec/standing_spec.rb
310
+ homepage: ''
311
+ licenses:
312
+ - MIT
313
+ metadata: {}
314
+ post_install_message:
315
+ rdoc_options: []
316
+ require_paths:
317
+ - lib
318
+ required_ruby_version: !ruby/object:Gem::Requirement
319
+ requirements:
320
+ - - ">="
321
+ - !ruby/object:Gem::Version
322
+ version: '0'
323
+ required_rubygems_version: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - ">="
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
328
+ requirements: []
329
+ rubyforge_project:
330
+ rubygems_version: 2.4.6
331
+ signing_key:
332
+ specification_version: 4
333
+ summary: Interface with football-api
334
+ test_files:
335
+ - spec/commentary_spec.rb
336
+ - spec/competition_spec.rb
337
+ - spec/fixture_spec.rb
338
+ - spec/helpers/json_helper.rb
339
+ - spec/json/commentaries.json
340
+ - spec/json/competitions.json
341
+ - spec/json/fixtures.json
342
+ - spec/json/matches.json
343
+ - spec/json/standings.json
344
+ - spec/match_spec.rb
345
+ - spec/spec_helper.rb
346
+ - spec/standing_spec.rb