infostrada 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2dd533448a91a1b090878ddfd3f17511ee2b12e3
4
- data.tar.gz: 360ba9f49d0a8251b8ded416a7b88a5ec64942fe
3
+ metadata.gz: 3a01822268a9c58ef0ef5c1a44515dd82c10909d
4
+ data.tar.gz: 2b17d56c7647aa2bb9fef8213ed2134b036ce463
5
5
  SHA512:
6
- metadata.gz: 7bddef94dd4f71cf3219fce10b7e434ea986b65388b80373c4a5f57c2b7bb530fac389728855cee1ba4d76cbcc50f795ed42158f78e3d26ef178793bc40490dc
7
- data.tar.gz: afa8478ce73a7239bcac063b2eab9de8c1275f6f74b93bfd9465e79f584ece3fe00e685f1ea0a3683734fae321a9867c41bda3cb6319e77b33328ff3e9a08a5d
6
+ metadata.gz: 58fd3ffee3668102cb76d3bee6f501dd35bc41c9be7ae06cc6b3d9d6d3a4fca5d4ca794a5415199e5e986794505bca106d0f26ab97c78bdc46090590c09ded7a
7
+ data.tar.gz: eccf55d6371519a51777b5189f927f5d93055ae76d922971b081cdc41fdb3b2e7260927688a41f947e15e1e971a38ff5219f9fe69cd1168c974ad379b2853fea
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- infostrada (0.1.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.0)
17
+ httparty (0.13.1)
18
18
  json (~> 1.8)
19
19
  multi_xml (>= 0.5.2)
20
20
  json (1.8.1)
@@ -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, :retries, :base_uri
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('infostrada.pstore')
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) }
@@ -7,4 +7,7 @@ module Infostrada
7
7
 
8
8
  class RequestError < BaseError
9
9
  end
10
+
11
+ class InfostradaError < BaseError
12
+ end
10
13
  end
@@ -1,3 +1,3 @@
1
1
  module Infostrada
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infostrada
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero