sports_data_api 0.11.5 → 0.11.6

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: 1573bfabde4846e7900508165cdf0ab809c9bd1b
4
- data.tar.gz: 463c8b2301292be250d5534c231812c061da9413
3
+ metadata.gz: 3511d9beaa61092bb9e781e948e51229d09daeb5
4
+ data.tar.gz: e6c9aafd2aacffa71397b865c151cb71a5bfa21c
5
5
  SHA512:
6
- metadata.gz: 10fe3f991743a639118a3c2cccc2b1ccd1c8df486b7bf7bb554f46d70616bb1341e7a1b6cc83b97dbe9c2bbae82af366754b84a8c91f65da5b095c9b2ec07d22
7
- data.tar.gz: 8b2836362ed1e771a44365d4e5e18aebce07ba08316431176b0fc4947b595a6d55149e58db23508494e44a2bff2f621606aecb6b1614ba4c5e2195f4a72ac3e4
6
+ metadata.gz: 9dc906dedbf8503dbe1aed7dc3bedbf78f8f9fdb444fc9d2344bb322c94059224c7335f5558a972511aa24831bcda20e9ebe86d7350511107d90c0e26ab7d9dd
7
+ data.tar.gz: 6e7aaebc3155e47b2975c7faf65d55fdd22eb1adfa6217f70af9979676306ae5d468e146c0bb91bd3288ef96c4fd6d96f0a4bc7ee55c9b13ab86ed422533bba2
data/.gitignore CHANGED
@@ -31,3 +31,5 @@ doc/
31
31
 
32
32
  # RubyMine
33
33
  .idea/
34
+
35
+ .byebug_history
@@ -51,7 +51,7 @@ module SportsDataApi
51
51
  # Fetches MLB daily summary
52
52
  def daily_summary(year, month, day)
53
53
  response = response_json("/games/#{year}/#{month}/#{day}/summary.json")
54
- map_model response['league'], 'games', Game
54
+ map_model response['league'], 'games', Game, 'game'
55
55
  end
56
56
 
57
57
  ##
@@ -69,9 +69,9 @@ module SportsDataApi
69
69
 
70
70
  private
71
71
 
72
- def map_model(json, key, klass)
72
+ def map_model(json, key, klass, data_key = nil)
73
73
  json[key].map do |data|
74
- klass.new(data)
74
+ klass.new(data_key ? data[data_key] : data)
75
75
  end
76
76
  end
77
77
  end
@@ -1,3 +1,3 @@
1
1
  module SportsDataApi
2
- VERSION = '0.11.5'
2
+ VERSION = '0.11.6'
3
3
  end
@@ -123,8 +123,15 @@ describe SportsDataApi::Mlb do
123
123
  summary_json = RestClient.get("#{daily_url}?api_key=#{api_key(:mlb)}")
124
124
  allow(RestClient).to receive(:get) { summary_json }
125
125
 
126
- subject.daily_summary(2016, 9, 24)
127
-
126
+ games = subject.daily_summary(2016, 9, 24)
127
+
128
+ game = games.first
129
+ expect(games.count).to eq 15
130
+ expect(game).to be_instance_of(SportsDataApi::Mlb::Game)
131
+ expect(game[:home]).to be_instance_of(SportsDataApi::Mlb::Team)
132
+ expect(game.home[:id]).to eq '27a59d3b-ff7c-48ea-b016-4798f560f5e1'
133
+ expect(game[:away]).to be_instance_of(SportsDataApi::Mlb::Team)
134
+ expect(game.away[:id]).to eq 'd99f919b-1534-4516-8e8a-9cd106c6d8cd'
128
135
  params = { params: { api_key: SportsDataApi.key(:mlb) } }
129
136
  expect(RestClient).to have_received(:get).with(daily_url, params)
130
137
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sports_data_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Lovelett
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-17 00:00:00.000000000 Z
12
+ date: 2017-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri