infostrada 0.1.2 → 0.1.3
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/lib/infostrada/base_request.rb +2 -8
- data/lib/infostrada/edition_request.rb +0 -2
- data/lib/infostrada/endpoints_poller.rb +3 -0
- data/lib/infostrada/version.rb +1 -1
- data/lib/infostrada.rb +17 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dd533448a91a1b090878ddfd3f17511ee2b12e3
|
4
|
+
data.tar.gz: 360ba9f49d0a8251b8ded416a7b88a5ec64942fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bddef94dd4f71cf3219fce10b7e434ea986b65388b80373c4a5f57c2b7bb530fac389728855cee1ba4d76cbcc50f795ed42158f78e3d26ef178793bc40490dc
|
7
|
+
data.tar.gz: afa8478ce73a7239bcac063b2eab9de8c1275f6f74b93bfd9465e79f584ece3fe00e685f1ea0a3683734fae321a9867c41bda3cb6319e77b33328ff3e9a08a5d
|
@@ -6,20 +6,14 @@ module Infostrada
|
|
6
6
|
include HTTParty
|
7
7
|
|
8
8
|
# How many times should we retry the request if Timeout::Error is raised?
|
9
|
-
RETRIES =
|
9
|
+
RETRIES = 5
|
10
10
|
|
11
11
|
# Uncomment to debug HTTParty calls.
|
12
12
|
# debug_output $stdout
|
13
13
|
|
14
|
-
basic_auth Infostrada.configuration.username, Infostrada.configuration.password
|
15
|
-
|
16
14
|
# The default format of the requests. Used on HTTP header 'Content-Type'.
|
17
15
|
format :json
|
18
16
|
|
19
|
-
# Base URI of the service. Since the gem is only football related for now we can have the
|
20
|
-
# football path already in the base_uri.
|
21
|
-
base_uri 'demo.api.infostradasports.com/svc/Football.svc/json/'
|
22
|
-
|
23
17
|
# Which default parameters we can send in every request?
|
24
18
|
#
|
25
19
|
# languageCode can be one of the following:
|
@@ -33,7 +27,7 @@ module Infostrada
|
|
33
27
|
default_params languageCode: 2
|
34
28
|
|
35
29
|
# Default request timeout in seconds. This can be overriden by module configuration.
|
36
|
-
default_timeout
|
30
|
+
default_timeout 15
|
37
31
|
|
38
32
|
# Disable the use of rails query string format.
|
39
33
|
#
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'eventmachine'
|
2
2
|
|
3
|
+
require 'infostrada/base_request'
|
4
|
+
require 'infostrada/call_refresh'
|
5
|
+
|
3
6
|
module Infostrada
|
4
7
|
# This is the base class that you should subclass to make a new endpoints poller. You should also
|
5
8
|
# call the EndpointsPoller.set_frequency and EndpointsPoller.listen_to and define a
|
data/lib/infostrada/version.rb
CHANGED
data/lib/infostrada.rb
CHANGED
@@ -1,30 +1,44 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
3
2
|
require 'httparty'
|
4
3
|
|
4
|
+
require 'infostrada/core_ext/string'
|
5
|
+
require 'infostrada/base_request'
|
6
|
+
|
5
7
|
module Infostrada
|
6
8
|
# The configuration of the API requests.
|
7
9
|
class Configuration
|
8
|
-
attr_reader :username, :password, :timeout, :retries
|
10
|
+
attr_reader :username, :password, :timeout, :retries, :base_uri
|
9
11
|
|
10
12
|
def username=(username)
|
13
|
+
BaseRequest.default_options[:basic_auth] ||= {}
|
11
14
|
BaseRequest.default_options[:basic_auth].merge!(username: username)
|
12
15
|
@username = username
|
13
16
|
end
|
14
17
|
|
15
18
|
def password=(password)
|
19
|
+
BaseRequest.default_options[:basic_auth] ||= {}
|
16
20
|
BaseRequest.default_options[:basic_auth].merge!(password: password)
|
17
21
|
@password = password
|
18
22
|
end
|
19
23
|
|
24
|
+
# Default timeout is 15 seconds.
|
20
25
|
def timeout=(timeout)
|
21
|
-
BaseRequest.
|
26
|
+
BaseRequest.default_timeout(timeout)
|
22
27
|
@timeout = timeout
|
23
28
|
end
|
24
29
|
|
25
30
|
def retries=(retries)
|
26
31
|
@retries = retries
|
27
32
|
end
|
33
|
+
|
34
|
+
# Base URI of the service. Since the gem is only football related for now we can have the
|
35
|
+
# football path already in the base_uri.
|
36
|
+
def domain=(domain)
|
37
|
+
base_uri = "#{domain}/svc/Football.svc/json/"
|
38
|
+
|
39
|
+
BaseRequest.base_uri(base_uri)
|
40
|
+
@base_uri = base_uri
|
41
|
+
end
|
28
42
|
end
|
29
43
|
|
30
44
|
class << self
|
@@ -38,8 +52,6 @@ module Infostrada
|
|
38
52
|
end
|
39
53
|
end
|
40
54
|
|
41
|
-
require 'infostrada/core_ext/string'
|
42
|
-
|
43
55
|
require 'infostrada/competition'
|
44
56
|
|
45
57
|
require 'infostrada/edition'
|
@@ -63,6 +75,4 @@ require 'infostrada/squad'
|
|
63
75
|
require 'infostrada/player'
|
64
76
|
require 'infostrada/person_info'
|
65
77
|
|
66
|
-
require 'infostrada/call_refresh'
|
67
|
-
|
68
78
|
require 'infostrada/version'
|
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.1.
|
4
|
+
version: 0.1.3
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|