infostrada 0.1.10 → 0.1.11
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 +8 -8
 - data/lib/infostrada/call_refresh.rb +1 -18
 - data/lib/infostrada/endpoint.rb +25 -0
 - data/lib/infostrada/endpoints_poller.rb +0 -2
 - data/lib/infostrada/match_event.rb +22 -1
 - data/lib/infostrada/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                YTQ4NDExZTBjZGRhMmEwN2JkYzNjOWQ0MDMxZDE2Y2M0NTYxNzFhYQ==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                ZDFkZWY2ODY5OGY1ZTE2ZDhkNTQxYTdmNmQ4YjJiZjc5NTA2NDNiMQ==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                OTNiM2I1ZTBhNmM3NTY1YzZkNzZmOTE3ZTc2ODkwNTJkZjFiZDdlYjVlZjUz
         
     | 
| 
      
 10 
     | 
    
         
            +
                NWI2NzU5YzJmNDE3MDc5YmUwOTMwNThkMTFhMTliNTJiOTExNDQ2MjkzZDdk
         
     | 
| 
      
 11 
     | 
    
         
            +
                OTc4MDU3MmZlYTdiNWZmZmEzNGI4YWFkZDQ3MDE4ZWZkZGU5MTI=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                ZjJjMDgzYjUxNDVlMmFkZDkzZTBlNWI0YzY2OTgxYmY3ZjdlNjc1MmRjZThm
         
     | 
| 
      
 14 
     | 
    
         
            +
                NmI1YjE4ZTgxOGZiNDhhODk0ZjI2YzFmN2NmNDI1NjZhYjMyNTJlYzcxNGIy
         
     | 
| 
      
 15 
     | 
    
         
            +
                ZGY3NGU5NmZkZjEzM2RkZTA1NGQ4OWI4MzA4OGY2ZGUxODExYTg=
         
     | 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'pstore'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'tzinfo'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'infostrada/endpoint'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            module Infostrada
         
     | 
| 
       5 
6 
     | 
    
         
             
              class CallRefresh < Infostrada::BaseRequest
         
     | 
| 
         @@ -70,22 +71,4 @@ module Infostrada 
     | 
|
| 
       70 
71 
     | 
    
         
             
                  endpoints
         
     | 
| 
       71 
72 
     | 
    
         
             
                end
         
     | 
| 
       72 
73 
     | 
    
         
             
              end
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
              class Endpoint
         
     | 
| 
       75 
     | 
    
         
            -
                attr_accessor :method, :last_modified, :query_string
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                def initialize(hash)
         
     | 
| 
       78 
     | 
    
         
            -
                  @method = hash['c_Method']
         
     | 
| 
       79 
     | 
    
         
            -
                  @last_modified = Formatter.format_date(hash['d_LastModified'])
         
     | 
| 
       80 
     | 
    
         
            -
                  @query_string = hash['c_QueryString']
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                  self
         
     | 
| 
       83 
     | 
    
         
            -
                end
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                # Helper method to return the match id from the query string.
         
     | 
| 
       86 
     | 
    
         
            -
                def match_id
         
     | 
| 
       87 
     | 
    
         
            -
                  @query_string.match(/matchid=(\d+)/)
         
     | 
| 
       88 
     | 
    
         
            -
                  $1
         
     | 
| 
       89 
     | 
    
         
            -
                end
         
     | 
| 
       90 
     | 
    
         
            -
              end
         
     | 
| 
       91 
74 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Infostrada
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Endpoint
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_accessor :method, :last_modified, :query_string
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(hash)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @method = hash['c_Method']
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @last_modified = Formatter.format_date(hash['d_LastModified'])
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @query_string = hash['c_QueryString']
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  self
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                # Helper method to return the match id from the query string.
         
     | 
| 
      
 14 
     | 
    
         
            +
                def match_id
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @query_string.match(/matchid=(\d+)/)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  $1
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                # Helper method to return the phase id from the query string.
         
     | 
| 
      
 20 
     | 
    
         
            +
                def phase_id
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @query_string.match(/phaseid=(\d+)/)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  $1
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -47,8 +47,6 @@ module Infostrada 
     | 
|
| 
       47 
47 
     | 
    
         
             
                def run
         
     | 
| 
       48 
48 
     | 
    
         
             
                  EM.run do
         
     | 
| 
       49 
49 
     | 
    
         
             
                    EM.add_periodic_timer(self.class.polling_frequency) do
         
     | 
| 
       50 
     | 
    
         
            -
                      puts "[#{Time.now}] Refresh since #{CallRefresh.last_update}"
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
50 
     | 
    
         
             
                      endpoints = EndpointChecker.new(self.class.endpoints)
         
     | 
| 
       53 
51 
     | 
    
         | 
| 
       54 
52 
     | 
    
         
             
                      endpoints.callback { |endpoints| process_endpoints(endpoints) }
         
     | 
| 
         @@ -19,11 +19,28 @@ module Infostrada 
     | 
|
| 
       19 
19 
     | 
    
         
             
              # 14 = Temporarily out
         
     | 
| 
       20 
20 
     | 
    
         
             
              # 15 = Other
         
     | 
| 
       21 
21 
     | 
    
         
             
              # 16 = Time
         
     | 
| 
      
 22 
     | 
    
         
            +
              #
         
     | 
| 
      
 23 
     | 
    
         
            +
              # period_code is taken from Infostradas n_PeriodSort, that can have one of these values:
         
     | 
| 
      
 24 
     | 
    
         
            +
              #
         
     | 
| 
      
 25 
     | 
    
         
            +
              # 1 = Not started
         
     | 
| 
      
 26 
     | 
    
         
            +
              # 2 = 1st Half
         
     | 
| 
      
 27 
     | 
    
         
            +
              # 3 = Halftime
         
     | 
| 
      
 28 
     | 
    
         
            +
              # 4 = 2nd Half
         
     | 
| 
      
 29 
     | 
    
         
            +
              # 5 = 90 mins
         
     | 
| 
      
 30 
     | 
    
         
            +
              # 6 = 1st Extra Time
         
     | 
| 
      
 31 
     | 
    
         
            +
              # 7 = 105 mins
         
     | 
| 
      
 32 
     | 
    
         
            +
              # 8 = 2nd Extra Time
         
     | 
| 
      
 33 
     | 
    
         
            +
              # 9 = 120 mins
         
     | 
| 
      
 34 
     | 
    
         
            +
              # 10 = Penalty Shootout
         
     | 
| 
      
 35 
     | 
    
         
            +
              # 11 = End
         
     | 
| 
       22 
36 
     | 
    
         
             
              class MatchEvent
         
     | 
| 
       23 
37 
     | 
    
         
             
                attr_accessor :id, :description, :short_description, :period, :period_short, :time, :home_goals
         
     | 
| 
       24 
38 
     | 
    
         
             
                attr_accessor :away_goals, :home_event, :team_id, :team_name, :team_short_name, :person_id
         
     | 
| 
       25 
39 
     | 
    
         
             
                attr_accessor :person_name, :person_short_name, :reason, :info, :person2_id, :person2_name
         
     | 
| 
       26 
     | 
    
         
            -
                attr_accessor :person2_short_name, :minute, :match_id, :action_set
         
     | 
| 
      
 40 
     | 
    
         
            +
                attr_accessor :person2_short_name, :minute, :match_id, :action_set, :period_code
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                # These action codes are documented on the Infostrada ADVANCED PROGRAMMING documentation
         
     | 
| 
      
 43 
     | 
    
         
            +
                attr_accessor :action_code, :action_code_2, :action_code_3
         
     | 
| 
       27 
44 
     | 
    
         | 
| 
       28 
45 
     | 
    
         
             
                def initialize(match_id, hash)
         
     | 
| 
       29 
46 
     | 
    
         
             
                  @match_id = match_id
         
     | 
| 
         @@ -33,6 +50,7 @@ module Infostrada 
     | 
|
| 
       33 
50 
     | 
    
         
             
                  @short_description  = hash['c_ActionShort']
         
     | 
| 
       34 
51 
     | 
    
         
             
                  @period             = hash['c_Period']
         
     | 
| 
       35 
52 
     | 
    
         
             
                  @period_short       = hash['c_PeriodShort']
         
     | 
| 
      
 53 
     | 
    
         
            +
                  @period_code        = hash['n_PeriodSort']
         
     | 
| 
       36 
54 
     | 
    
         
             
                  @time               = hash['n_ActionTime']
         
     | 
| 
       37 
55 
     | 
    
         
             
                  @home_goals         = hash['n_HomeGoals']
         
     | 
| 
       38 
56 
     | 
    
         
             
                  @away_goals         = hash['n_AwayGoals']
         
     | 
| 
         @@ -50,6 +68,9 @@ module Infostrada 
     | 
|
| 
       50 
68 
     | 
    
         
             
                  @person2_short_name = hash['c_SubPersonShort']
         
     | 
| 
       51 
69 
     | 
    
         
             
                  @minute             = hash['c_ActionMinute']
         
     | 
| 
       52 
70 
     | 
    
         
             
                  @action_set         = hash['n_ActionSet']
         
     | 
| 
      
 71 
     | 
    
         
            +
                  @action_code        = hash['n_ActionCode']
         
     | 
| 
      
 72 
     | 
    
         
            +
                  @action_code_2      = hash['n_ActionCode2']
         
     | 
| 
      
 73 
     | 
    
         
            +
                  @action_code_3      = hash['n_ActionCode3']
         
     | 
| 
       53 
74 
     | 
    
         | 
| 
       54 
75 
     | 
    
         
             
                  self
         
     | 
| 
       55 
76 
     | 
    
         
             
                end
         
     | 
    
        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.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.11
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-05-06 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -220,6 +220,7 @@ files: 
     | 
|
| 
       220 
220 
     | 
    
         
             
            - lib/infostrada/core_ext/string.rb
         
     | 
| 
       221 
221 
     | 
    
         
             
            - lib/infostrada/edition.rb
         
     | 
| 
       222 
222 
     | 
    
         
             
            - lib/infostrada/edition_request.rb
         
     | 
| 
      
 223 
     | 
    
         
            +
            - lib/infostrada/endpoint.rb
         
     | 
| 
       223 
224 
     | 
    
         
             
            - lib/infostrada/endpoints_poller.rb
         
     | 
| 
       224 
225 
     | 
    
         
             
            - lib/infostrada/errors.rb
         
     | 
| 
       225 
226 
     | 
    
         
             
            - lib/infostrada/formatter.rb
         
     |