football_api 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21a0d99dfe557710909ee14f978a635b82edddc2
4
- data.tar.gz: 867b8a415e2ce6f3c2e391d98209848e930d2046
3
+ metadata.gz: 13b8c69cc770246caab805f50882509599ae5118
4
+ data.tar.gz: d1f8e0191399bed5dea6af6e90f2479e861aa973
5
5
  SHA512:
6
- metadata.gz: 98bf270b05b7a8b8a1f83a772c9b8d31a1fe9ed88a3a5f4681638a75e0dcedff107bcd983152d8af02615a641e77767b4bbc189af3d1a06728552fe0e36c73b5
7
- data.tar.gz: 50fa002b215163cc0fd4c7ccb33e72724ba62650b6371ce3a39b6421bf5b80719d900d6f9f0e474f5df8f82802381b92d2332cd619530f3b9b85fbe346f01a38
6
+ metadata.gz: 356d5eda47d2ff3d2005e206d8527fed382cbb45b5a9a28ba72729fbb71f824acf0185572f99d41055b91258a4af0817544636865970c3e4e457657672fa0dd9
7
+ data.tar.gz: 4645b4c4d4c3347582e4c44fd59dae3de05bc65b1fc405bfc74d76307f8497806a3bc0452cd844c1b61b09278713610a67a095c0c4790bac1a940819bf1b66a1
@@ -3,7 +3,7 @@ module FootballApi
3
3
  include HTTParty
4
4
  include FootballApi::Symbolizer
5
5
 
6
- debug_output $stdout
6
+ debug_output $stdout if ENV.fetch('DEBUG', false)
7
7
  # Disable the use of rails query string format.
8
8
  #
9
9
  # With rails query string format enabled:
@@ -3,12 +3,17 @@ module FootballApi
3
3
  include FootballApi::Requestable
4
4
 
5
5
  api_options action: :today,
6
- action_params: :match_params,
7
- json_key: :matches
6
+ action_params: :match_params,
7
+ json_key: :matches
8
8
 
9
9
  class << self
10
10
  attr_accessor :competition_id
11
11
 
12
+ def today
13
+ @competition_id = nil
14
+ Array(response).map { |match| new(match) }
15
+ end
16
+
12
17
  def all_from_competition(competition)
13
18
  @competition_id = competition.is_a?(Competition) ? competition.id : competition
14
19
 
@@ -16,7 +21,7 @@ module FootballApi
16
21
  end
17
22
 
18
23
  def match_params
19
- { comp_id: self.competition_id}
24
+ self.competition_id ? { comp_id: self.competition_id} : {}
20
25
  end
21
26
  end
22
27
 
@@ -54,6 +59,11 @@ module FootballApi
54
59
  @match_venue_beta = hash[:match_venue_beta]
55
60
  @match_venue_id_beta = hash[:match_venue_id_beta]
56
61
  @match_venue_city_beta = hash[:match_venue_city_beta]
62
+ @match_events = parse_match_events(hash[:match_events])
63
+ end
64
+
65
+ def parse_match_events(arr = [])
66
+ Array(arr).map { |e| FootballApi::Event.new(e) }
57
67
  end
58
68
  end
59
69
  end
@@ -4,7 +4,7 @@ module FootballApi
4
4
  base.extend(ClassMethods)
5
5
  end
6
6
 
7
- HASH_OR_ARRAY_KEYS = %i(player substitution comment)
7
+ HASH_OR_ARRAY_KEYS = %i(player substitution comment match_events)
8
8
 
9
9
  module ClassMethods
10
10
  # Custom deep symbolize of an hash
@@ -1,3 +1,3 @@
1
1
  module FootballApi
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: football_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Afonso Tsukamoto