espn_pub 0.1.8 → 0.1.9

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
  SHA256:
3
- metadata.gz: 2313dc03f24eb1a9ece5883a51a186acd8497790d2d6b2b4291cdaa997c4c977
4
- data.tar.gz: f2238e3abe174ade734ac70e183d2741e9f11f5fd49a96d6a77000b82086cd75
3
+ metadata.gz: 8b3eef8ac8d68e39e8b6a71bf2d710c7a23201942ae3bc9a36295860bea269e6
4
+ data.tar.gz: 5511f7625ee3536feb3a99a916bdac63e0f7b3e1f386a3508432661e4b28302c
5
5
  SHA512:
6
- metadata.gz: 32011085498d278e9076c1332e53bc6aee395345f30adc547ded45705713e7e358e2c3da8663f3abd0c1ec7f179fc6b4f703f4d84e27c4f6f9ccc3dd79d4eb3f
7
- data.tar.gz: 2b4bbf38c0aa43eeee07b4848c7eaaf9bde8d167cacb2890c657ea668ebd5132042a51b815c5485eaece594d7f8a3cab89ae8290f3eec5c99a6e29dce15de9f6
6
+ metadata.gz: 3a38ba745e476818d6c54041768770cab08ec743f04b5f77100b5df547b082a72398a2f19e40bc5785703388c6da00112bd9e1cd8db8a978a60f2403366449e8
7
+ data.tar.gz: bc39cc00273050649458bb76a26c3652e26be7958db8d2da5332609171771c189708e860d61cefd3e085195ddd475179774142ce066016ba0f33698c4c01de2a
@@ -16,7 +16,7 @@ module EspnPub
16
16
  3 => Type::POSTSEASON
17
17
  }.freeze
18
18
 
19
- attr_reader :id, :home_team, :away_team, :date, :type
19
+ attr_reader :id, :home_team, :away_team, :date, :type, :venue
20
20
 
21
21
  # Initialize a Game entity.
22
22
  #
@@ -25,12 +25,14 @@ module EspnPub
25
25
  # @param away_team [EspnPub::Entities::Team] The away team.
26
26
  # @param date [DateTime] The scheduled game date.
27
27
  # @param type [String] The type of the game.
28
- def initialize(id:, home_team:, away_team:, date:, type: nil)
28
+ # @param venue [EspnPub::Entities::Venue] The venue of the game.
29
+ def initialize(id:, home_team:, away_team:, date:, type: nil, venue: nil)
29
30
  @id = id
30
31
  @home_team = home_team
31
32
  @away_team = away_team
32
33
  @date = date
33
34
  @type = type
35
+ @venue = venue
34
36
  super()
35
37
  end
36
38
  end
@@ -97,7 +97,8 @@ module EspnPub
97
97
  sport: sport,
98
98
  league_name: league_name
99
99
  ),
100
- date: DateTime.parse(game_data['date'])
100
+ date: DateTime.parse(game_data['date']),
101
+ venue: EspnPub::Entities::Venue.from_api(game_data.dig('competitions', 0, 'venue'))
101
102
  )
102
103
  end
103
104
  rescue Client::UnexpectedResponseCodeError => e
@@ -33,14 +33,13 @@ module EspnPub
33
33
  # @param position [String, nil] The player's position abbreviation.
34
34
  # @param team_id [String, nil] The identifier of the player's team.
35
35
  # @param date_of_birth [Date, nil] The player's date of birth.
36
- # @param birth_city [String, nil] The player's birth city.
37
- # @param birth_state [String, nil] The player's birth state.
38
- # @param birth_country [String, nil] The player's birth country.
36
+ # @param birth_place_data [Hash, nil] The player's birth place data.
39
37
  # @param height [String, nil] The player's listed height.
40
38
  # @param weight [String, nil] The player's listed weight.
41
39
  # @param debut_year [Integer, nil] The year the player made their debut.
42
40
  def initialize(id:, sport:, league_name:, first_name: nil, last_name: nil, position: nil, team_id: nil,
43
- date_of_birth: nil, birth_city: nil, birth_state: nil, birth_country: nil, height: nil, weight: nil, debut_year: nil)
41
+ date_of_birth: nil, height: nil, weight: nil, debut_year: nil,
42
+ birth_place_data: {})
44
43
  @id = id
45
44
  @sport = sport
46
45
  @league_name = league_name
@@ -49,9 +48,9 @@ module EspnPub
49
48
  @position = position
50
49
  @team_id = team_id
51
50
  @date_of_birth = self.class.parse_date_of_birth(date_of_birth)
52
- @birth_city = birth_city
53
- @birth_state = birth_state
54
- @birth_country = birth_country
51
+ @birth_city = birth_place_data['city']
52
+ @birth_state = birth_place_data['state']
53
+ @birth_country = birth_place_data['country']
55
54
  @height = height
56
55
  @weight = weight
57
56
  @debut_year = debut_year
@@ -85,9 +84,7 @@ module EspnPub
85
84
  position: athlete_data.dig('position', 'abbreviation'),
86
85
  team_id: athlete_data.dig('team', 'id'),
87
86
  date_of_birth: parse_date_of_birth(athlete_data['dateOfBirth']),
88
- birth_city: athlete_data.dig('birthPlace', 'city'),
89
- birth_state: athlete_data.dig('birthPlace', 'state'),
90
- birth_country: athlete_data.dig('birthPlace', 'country'),
87
+ birth_place_data: athlete_data['birthPlace'],
91
88
  height: athlete_data['displayHeight'],
92
89
  weight: athlete_data['displayWeight'],
93
90
  debut_year: athlete_data['debutYear']
@@ -77,9 +77,7 @@ module EspnPub
77
77
  last_name: athlete_data['lastName'],
78
78
  position: athlete_data['position']['abbreviation'],
79
79
  team_id: id,
80
- birth_city: athlete_data.dig('birthPlace', 'city'),
81
- birth_state: athlete_data.dig('birthPlace', 'state'),
82
- birth_country: athlete_data.dig('birthPlace', 'country'),
80
+ birth_place_data: athlete_data&.fetch('birthPlace', {}),
83
81
  date_of_birth: athlete_data['dateOfBirth'],
84
82
  height: athlete_data['height'],
85
83
  weight: athlete_data['weight'],
@@ -7,10 +7,7 @@ module EspnPub
7
7
  attr_reader :id,
8
8
  :full_name,
9
9
  :short_name,
10
- :city,
11
- :state,
12
- :zip_code,
13
- :country,
10
+ :address_data,
14
11
  :indoor,
15
12
  :grass
16
13
 
@@ -19,21 +16,14 @@ module EspnPub
19
16
  # @param id [String] The venue identifier.
20
17
  # @param full_name [String, nil] The venue's full name.
21
18
  # @param short_name [String, nil] The venue's short name.
22
- # @param city [String, nil] The venue's city.
23
- # @param state [String, nil] The venue's state or province.
24
- # @param zip_code [String, nil] The venue's postal code.
25
- # @param country [String, nil] The venue's country.
19
+ # @param address_data [Hash, nil] The venue's address data.
26
20
  # @param indoor [Boolean, nil] Whether the venue is indoors.
27
21
  # @param grass [Boolean, nil] Whether the venue has a grass surface.
28
- def initialize(id:, full_name: nil, short_name: nil, city: nil, state: nil, zip_code: nil, country: nil,
29
- indoor: nil, grass: nil)
22
+ def initialize(id:, full_name: nil, short_name: nil, indoor: nil, grass: nil, address_data: {})
30
23
  @id = id
31
24
  @full_name = full_name
32
25
  @short_name = short_name
33
- @city = city
34
- @state = state
35
- @zip_code = zip_code
36
- @country = country
26
+ @address_data = address_data
37
27
  @indoor = indoor
38
28
  @grass = grass
39
29
  super()
@@ -50,10 +40,7 @@ module EspnPub
50
40
  id: data['id'],
51
41
  full_name: data['fullName'],
52
42
  short_name: data['shortName'],
53
- city: data.dig('address', 'city'),
54
- state: data.dig('address', 'state'),
55
- zip_code: data.dig('address', 'zipCode'),
56
- country: data.dig('address', 'country'),
43
+ address_data: data['address'],
57
44
  indoor: data['indoor'],
58
45
  grass: data['grass']
59
46
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EspnPub
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: espn_pub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey Bowman