infostrada 0.0.10 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -22
- data/infostrada.gemspec +10 -10
- data/lib/infostrada/base_request.rb +0 -12
- data/lib/infostrada/endpoints_poller.rb +48 -0
- data/lib/infostrada/match.rb +5 -4
- data/lib/infostrada/version.rb +1 -1
- metadata +71 -29
- data/lib/infostrada/endpoint_manager.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 056a9814b1582d72d2e88e5dc3aa2c9bef44350c
|
4
|
+
data.tar.gz: 7395f9bc6a499fee10d1eab7c41cb35b4ba1fb53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2734d1c0810f909cbcea929cdf5f58c3e6c9bbb6a1969371346913b57ae746273d5ff0d4dddcc06334b3936ab8eedc03ce0d3f1bd2892fb4e6b9479f6e13cfc
|
7
|
+
data.tar.gz: 0f0db14a2daeb806e6ec73fbed8d634178f28d76af9dde9c8c0ce31a0567ec8daffe10bf1ee535f5171fcb9edc646f974791748b9efdded54f9b668d2f5db1f9
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
infostrada (0.0
|
5
|
-
colored
|
6
|
-
|
7
|
-
|
8
|
-
tzinfo
|
4
|
+
infostrada (0.1.0)
|
5
|
+
colored (~> 1.2)
|
6
|
+
eventmachine (~> 1.0.3)
|
7
|
+
httparty (~> 0.13.0)
|
8
|
+
tzinfo (~> 1.1.0)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
@@ -13,13 +13,14 @@ GEM
|
|
13
13
|
ast (1.1.0)
|
14
14
|
coderay (1.1.0)
|
15
15
|
colored (1.2)
|
16
|
+
eventmachine (1.0.3)
|
16
17
|
httparty (0.13.0)
|
17
18
|
json (~> 1.8)
|
18
19
|
multi_xml (>= 0.5.2)
|
19
20
|
json (1.8.1)
|
20
21
|
method_source (0.8.2)
|
21
22
|
multi_xml (0.5.5)
|
22
|
-
parser (2.1.
|
23
|
+
parser (2.1.7)
|
23
24
|
ast (~> 1.1)
|
24
25
|
slop (~> 3.4, >= 3.4.5)
|
25
26
|
powerpack (0.0.9)
|
@@ -28,25 +29,29 @@ GEM
|
|
28
29
|
method_source (~> 0.8)
|
29
30
|
slop (~> 3.4)
|
30
31
|
rainbow (2.0.0)
|
31
|
-
rake (10.
|
32
|
-
|
33
|
-
|
34
|
-
ruby2ruby (~> 2.0.
|
35
|
-
ruby_parser (~> 3.
|
32
|
+
rake (10.2.2)
|
33
|
+
reek (1.3.7)
|
34
|
+
rainbow
|
35
|
+
ruby2ruby (~> 2.0.8)
|
36
|
+
ruby_parser (~> 3.3)
|
36
37
|
sexp_processor
|
37
|
-
rubocop (0.
|
38
|
+
rubocop (0.20.1)
|
38
39
|
json (>= 1.7.7, < 2)
|
39
|
-
parser (~> 2.1.
|
40
|
+
parser (~> 2.1.7)
|
40
41
|
powerpack (~> 0.0.6)
|
41
42
|
rainbow (>= 1.99.1, < 3.0)
|
42
|
-
|
43
|
+
ruby-progressbar (~> 1.4)
|
44
|
+
ruby-progressbar (1.4.2)
|
45
|
+
ruby2ruby (2.0.8)
|
43
46
|
ruby_parser (~> 3.1)
|
44
47
|
sexp_processor (~> 4.0)
|
45
|
-
ruby_parser (3.
|
48
|
+
ruby_parser (3.5.0)
|
46
49
|
sexp_processor (~> 4.1)
|
47
|
-
sexp_processor (4.4.
|
48
|
-
slop (3.
|
49
|
-
|
50
|
+
sexp_processor (4.4.3)
|
51
|
+
slop (3.5.0)
|
52
|
+
thread_safe (0.3.3)
|
53
|
+
tzinfo (1.1.0)
|
54
|
+
thread_safe (~> 0.1)
|
50
55
|
|
51
56
|
PLATFORMS
|
52
57
|
ruby
|
@@ -54,7 +59,7 @@ PLATFORMS
|
|
54
59
|
DEPENDENCIES
|
55
60
|
bundler (~> 1.5)
|
56
61
|
infostrada!
|
57
|
-
pry
|
58
|
-
rake
|
59
|
-
reek
|
60
|
-
rubocop
|
62
|
+
pry (~> 0.9.12)
|
63
|
+
rake (~> 10.2.2)
|
64
|
+
reek (~> 1.3.7)
|
65
|
+
rubocop (~> 0.20.1)
|
data/infostrada.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Ricardo Otero']
|
10
10
|
spec.email = ['oterosantos@gmail.com']
|
11
11
|
spec.summary = 'Infostrada Football API wrapper.'
|
12
|
-
spec.description = 'Infostrada Football API
|
13
|
-
spec.homepage = ''
|
12
|
+
spec.description = 'Wrapper for the Infostrada Football API using httparty.'
|
13
|
+
spec.homepage = 'https://github.com/rikas/infostrada-api'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
|
-
spec.add_development_dependency 'rake'
|
23
|
-
spec.add_development_dependency 'reek'
|
24
|
-
spec.add_development_dependency 'rubocop'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.2', '>= 10.2.2'
|
23
|
+
spec.add_development_dependency 'reek', '~> 1.3', '>= 1.3.7'
|
24
|
+
spec.add_development_dependency 'rubocop', '~> 0.20', '>= 0.20.1'
|
25
|
+
spec.add_development_dependency 'pry', '~> 0.9', '>= 0.9.12'
|
25
26
|
|
26
|
-
spec.add_dependency 'httparty', '~> 0.
|
27
|
-
spec.add_dependency 'colored'
|
28
|
-
spec.add_dependency '
|
29
|
-
spec.add_dependency '
|
30
|
-
spec.add_development_dependency 'pry'
|
27
|
+
spec.add_dependency 'httparty', '~> 0.13', '>= 0.13.0'
|
28
|
+
spec.add_dependency 'colored', '~> 1.2'
|
29
|
+
spec.add_dependency 'tzinfo', '~> 1.1', '>= 1.1.0'
|
30
|
+
spec.add_dependency 'eventmachine', '~> 1.0', '>= 1.0.3'
|
31
31
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'infostrada/endpoint_manager'
|
2
|
-
|
3
1
|
module Infostrada
|
4
2
|
# This is the class that every class making API requests must descend from. It includes HTTParty
|
5
3
|
# to easily support every type of HTTP request. The basic_auth is set up from the
|
@@ -47,16 +45,6 @@ module Infostrada
|
|
47
45
|
#
|
48
46
|
disable_rails_query_string_format
|
49
47
|
|
50
|
-
class << self
|
51
|
-
attr_accessor :endpoint
|
52
|
-
|
53
|
-
def register_endpoint(endpoint)
|
54
|
-
self.endpoint = endpoint
|
55
|
-
|
56
|
-
EndpointManager.register(endpoint => self)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
48
|
# Used with Timeout::Error rescue so we can keep trying to fetch the information after timeout.
|
61
49
|
def self.get!(path, options = {}, &block)
|
62
50
|
attempts = 1
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'eventmachine'
|
2
|
+
|
3
|
+
module Infostrada
|
4
|
+
class EndpointsPoller
|
5
|
+
class << self
|
6
|
+
attr_accessor :polling_frequency, :endpoints
|
7
|
+
|
8
|
+
def set_frequency(frequency)
|
9
|
+
@polling_frequency = frequency
|
10
|
+
end
|
11
|
+
|
12
|
+
def listen_to(endpoints)
|
13
|
+
@endpoints = endpoints
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
EM.run {
|
19
|
+
EM.add_periodic_timer(self.class.polling_frequency) do
|
20
|
+
puts "[#{Time.now}] Refresh since #{CallRefresh.last_update}"
|
21
|
+
|
22
|
+
endpoints = EndpointChecker.new
|
23
|
+
endpoints.callback { |endpoints| process_endpoints(endpoints) }
|
24
|
+
endpoints.errback { |error| puts "ERROR: #{error}" }
|
25
|
+
end
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def process_endpoints(endpoints)
|
30
|
+
raise InfostradaError, 'You have to override process_endpoints method!'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class EndpointChecker
|
35
|
+
include EM::Deferrable
|
36
|
+
|
37
|
+
def initialize
|
38
|
+
begin
|
39
|
+
updated = Infostrada::CallRefresh.get_latest
|
40
|
+
updated = updated.select { |endpoint| self.class.endpoints.include?(endpoint.method) }
|
41
|
+
|
42
|
+
self.succeed(updated)
|
43
|
+
rescue => e
|
44
|
+
self.fail(e.message)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/infostrada/match.rb
CHANGED
@@ -67,10 +67,11 @@ module Infostrada
|
|
67
67
|
|
68
68
|
# We can get all matches for a given edition (very heavy payload). Or we can just get the match
|
69
69
|
# information on a single match.
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
URLS = {
|
71
|
+
list: '/GetMatchList_Edition',
|
72
|
+
single: '/GetMatchInfo',
|
73
|
+
live_list: '/GetMatchLiveList_Date'
|
74
|
+
}
|
74
75
|
|
75
76
|
def self.where(options = {})
|
76
77
|
list = get_match_list(options)
|
data/lib/infostrada/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infostrada
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Otero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,115 +28,157 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.2'
|
31
34
|
- - ">="
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
36
|
+
version: 10.2.2
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '10.2'
|
38
44
|
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: 10.2.2
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: reek
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.3'
|
45
54
|
- - ">="
|
46
55
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
56
|
+
version: 1.3.7
|
48
57
|
type: :development
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.3'
|
52
64
|
- - ">="
|
53
65
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
66
|
+
version: 1.3.7
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: rubocop
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0.20'
|
59
74
|
- - ">="
|
60
75
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
76
|
+
version: 0.20.1
|
62
77
|
type: :development
|
63
78
|
prerelease: false
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0.20'
|
66
84
|
- - ">="
|
67
85
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
86
|
+
version: 0.20.1
|
69
87
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
88
|
+
name: pry
|
71
89
|
requirement: !ruby/object:Gem::Requirement
|
72
90
|
requirements:
|
73
91
|
- - "~>"
|
74
92
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
76
|
-
|
93
|
+
version: '0.9'
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.9.12
|
97
|
+
type: :development
|
77
98
|
prerelease: false
|
78
99
|
version_requirements: !ruby/object:Gem::Requirement
|
79
100
|
requirements:
|
80
101
|
- - "~>"
|
81
102
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
103
|
+
version: '0.9'
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 0.9.12
|
83
107
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
108
|
+
name: httparty
|
85
109
|
requirement: !ruby/object:Gem::Requirement
|
86
110
|
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0.13'
|
87
114
|
- - ">="
|
88
115
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
116
|
+
version: 0.13.0
|
90
117
|
type: :runtime
|
91
118
|
prerelease: false
|
92
119
|
version_requirements: !ruby/object:Gem::Requirement
|
93
120
|
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0.13'
|
94
124
|
- - ">="
|
95
125
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
126
|
+
version: 0.13.0
|
97
127
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
128
|
+
name: colored
|
99
129
|
requirement: !ruby/object:Gem::Requirement
|
100
130
|
requirements:
|
101
|
-
- - "
|
131
|
+
- - "~>"
|
102
132
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
133
|
+
version: '1.2'
|
104
134
|
type: :runtime
|
105
135
|
prerelease: false
|
106
136
|
version_requirements: !ruby/object:Gem::Requirement
|
107
137
|
requirements:
|
108
|
-
- - "
|
138
|
+
- - "~>"
|
109
139
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
140
|
+
version: '1.2'
|
111
141
|
- !ruby/object:Gem::Dependency
|
112
142
|
name: tzinfo
|
113
143
|
requirement: !ruby/object:Gem::Requirement
|
114
144
|
requirements:
|
145
|
+
- - "~>"
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '1.1'
|
115
148
|
- - ">="
|
116
149
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
150
|
+
version: 1.1.0
|
118
151
|
type: :runtime
|
119
152
|
prerelease: false
|
120
153
|
version_requirements: !ruby/object:Gem::Requirement
|
121
154
|
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '1.1'
|
122
158
|
- - ">="
|
123
159
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
160
|
+
version: 1.1.0
|
125
161
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
162
|
+
name: eventmachine
|
127
163
|
requirement: !ruby/object:Gem::Requirement
|
128
164
|
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '1.0'
|
129
168
|
- - ">="
|
130
169
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
-
type: :
|
170
|
+
version: 1.0.3
|
171
|
+
type: :runtime
|
133
172
|
prerelease: false
|
134
173
|
version_requirements: !ruby/object:Gem::Requirement
|
135
174
|
requirements:
|
175
|
+
- - "~>"
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '1.0'
|
136
178
|
- - ">="
|
137
179
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
139
|
-
description: Infostrada Football API
|
180
|
+
version: 1.0.3
|
181
|
+
description: Wrapper for the Infostrada Football API using httparty.
|
140
182
|
email:
|
141
183
|
- oterosantos@gmail.com
|
142
184
|
executables:
|
@@ -158,7 +200,7 @@ files:
|
|
158
200
|
- lib/infostrada/core_ext/string.rb
|
159
201
|
- lib/infostrada/edition.rb
|
160
202
|
- lib/infostrada/edition_request.rb
|
161
|
-
- lib/infostrada/
|
203
|
+
- lib/infostrada/endpoints_poller.rb
|
162
204
|
- lib/infostrada/errors.rb
|
163
205
|
- lib/infostrada/formatter.rb
|
164
206
|
- lib/infostrada/match.rb
|
@@ -175,7 +217,7 @@ files:
|
|
175
217
|
- lib/infostrada/team_info.rb
|
176
218
|
- lib/infostrada/team_request.rb
|
177
219
|
- lib/infostrada/version.rb
|
178
|
-
homepage:
|
220
|
+
homepage: https://github.com/rikas/infostrada-api
|
179
221
|
licenses:
|
180
222
|
- MIT
|
181
223
|
metadata: {}
|