infostrada 0.1.3 → 0.1.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/infostrada.rb +2 -5
- data/lib/infostrada/base_request.rb +4 -0
- data/lib/infostrada/call_refresh.rb +1 -5
- data/lib/infostrada/endpoints_poller.rb +6 -0
- data/lib/infostrada/errors.rb +3 -0
- data/lib/infostrada/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a01822268a9c58ef0ef5c1a44515dd82c10909d
|
4
|
+
data.tar.gz: 2b17d56c7647aa2bb9fef8213ed2134b036ce463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58fd3ffee3668102cb76d3bee6f501dd35bc41c9be7ae06cc6b3d9d6d3a4fca5d4ca794a5415199e5e986794505bca106d0f26ab97c78bdc46090590c09ded7a
|
7
|
+
data.tar.gz: eccf55d6371519a51777b5189f927f5d93055ae76d922971b081cdc41fdb3b2e7260927688a41f947e15e1e971a38ff5219f9fe69cd1168c974ad379b2853fea
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
infostrada (0.1.
|
4
|
+
infostrada (0.1.3)
|
5
5
|
colored (~> 1.2)
|
6
6
|
eventmachine (~> 1.0, >= 1.0.3)
|
7
7
|
httparty (~> 0.13, >= 0.13.0)
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
coderay (1.1.0)
|
15
15
|
colored (1.2)
|
16
16
|
eventmachine (1.0.3)
|
17
|
-
httparty (0.13.
|
17
|
+
httparty (0.13.1)
|
18
18
|
json (~> 1.8)
|
19
19
|
multi_xml (>= 0.5.2)
|
20
20
|
json (1.8.1)
|
data/lib/infostrada.rb
CHANGED
@@ -7,7 +7,8 @@ require 'infostrada/base_request'
|
|
7
7
|
module Infostrada
|
8
8
|
# The configuration of the API requests.
|
9
9
|
class Configuration
|
10
|
-
attr_reader :username, :password, :timeout, :
|
10
|
+
attr_reader :username, :password, :timeout, :base_uri
|
11
|
+
attr_accessor :last_update_file, :retries
|
11
12
|
|
12
13
|
def username=(username)
|
13
14
|
BaseRequest.default_options[:basic_auth] ||= {}
|
@@ -27,10 +28,6 @@ module Infostrada
|
|
27
28
|
@timeout = timeout
|
28
29
|
end
|
29
30
|
|
30
|
-
def retries=(retries)
|
31
|
-
@retries = retries
|
32
|
-
end
|
33
|
-
|
34
31
|
# Base URI of the service. Since the gem is only football related for now we can have the
|
35
32
|
# football path already in the base_uri.
|
36
33
|
def domain=(domain)
|
@@ -11,6 +11,10 @@ module Infostrada
|
|
11
11
|
# Uncomment to debug HTTParty calls.
|
12
12
|
# debug_output $stdout
|
13
13
|
|
14
|
+
# TODO: can we delete this dummy values?
|
15
|
+
basic_auth 'USERNAME', 'PASSWORD'
|
16
|
+
base_uri = 'demo.api.infostradasports.com/svc/Football.svc/json/'
|
17
|
+
|
14
18
|
# The default format of the requests. Used on HTTP header 'Content-Type'.
|
15
19
|
format :json
|
16
20
|
|
@@ -9,10 +9,6 @@ module Infostrada
|
|
9
9
|
# call must be in the correct timezone.
|
10
10
|
TIMEZONE = 'Europe/Amsterdam'
|
11
11
|
|
12
|
-
# This is the only method on Infostrada API that don't use /Football.svc but /Utility.svc
|
13
|
-
# instead, so we have to replace that on the default base_uri.
|
14
|
-
Infostrada::CallRefresh.base_uri Infostrada::CallRefresh.base_uri.gsub(/Football/, 'Utility')
|
15
|
-
|
16
12
|
# Which languages are you interested in? The GetAPICallRefresh_Module call can return multiple
|
17
13
|
# endpoints for the same thing if multiple languages are available.
|
18
14
|
#
|
@@ -37,7 +33,7 @@ module Infostrada
|
|
37
33
|
DATE_FORMAT = '%FT%T'
|
38
34
|
|
39
35
|
def self.store
|
40
|
-
@store ||= PStore.new(
|
36
|
+
@store ||= PStore.new(Infostrada.configuration.last_update_file)
|
41
37
|
end
|
42
38
|
|
43
39
|
def self.last_update
|
@@ -39,6 +39,9 @@ module Infostrada
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
# Default frequency
|
43
|
+
set_frequency 15
|
44
|
+
|
42
45
|
# Main cycle that calls EM.run and will then use the EndpointsPoller#process_endpoints method
|
43
46
|
# to process the updated endpoints.
|
44
47
|
def run
|
@@ -65,6 +68,9 @@ module Infostrada
|
|
65
68
|
include EM::Deferrable
|
66
69
|
|
67
70
|
def initialize(endpoints_whitelist)
|
71
|
+
# The CallRefresh endpoint is the one using 'Utility' instead of 'Football'.
|
72
|
+
Infostrada::CallRefresh.base_uri Infostrada::CallRefresh.base_uri.gsub(/Football/, 'Utility')
|
73
|
+
|
68
74
|
begin
|
69
75
|
updated = Infostrada::CallRefresh.get_latest
|
70
76
|
updated = updated.select { |endpoint| endpoints_whitelist.include?(endpoint.method) }
|
data/lib/infostrada/errors.rb
CHANGED
data/lib/infostrada/version.rb
CHANGED