espn_pub 0.1.4 → 0.1.5
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/espn_pub/client.rb +1 -1
- data/lib/espn_pub/entities/player.rb +13 -13
- data/lib/espn_pub/entities/team.rb +6 -4
- data/lib/espn_pub/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2fbdccec83321ef32990d4db7408783c70d3d4d93f4e53fb748a24d3cbd97d69
|
|
4
|
+
data.tar.gz: 370ee304e44bf7b79d68fcd0263f80ba0b5e4b38101edfe840f85289e7684fd8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3679819cb7956a302e553b96ce92f460a12d9f7d19fb079d07a714237d7d06e67f64bb09cb539a65b9348732f881ac0172a9456b25d7955af4a45e44e6538612
|
|
7
|
+
data.tar.gz: 0ca9ead84f8a2d7713f0b63cae3cbb4e5f6570719d6262a357d69aa6d7a67f128ef95d50f128824043427a964aaf45c7b7c7faca4fd0e7a6c43f74d077d273f4
|
data/lib/espn_pub/client.rb
CHANGED
|
@@ -33,7 +33,7 @@ module EspnPub
|
|
|
33
33
|
request_uri = URI "#{BASE_URI}#{path}"
|
|
34
34
|
request = Net::HTTP::Get.new(request_uri)
|
|
35
35
|
|
|
36
|
-
request[
|
|
36
|
+
request['User-Agent'] = user_agent if user_agent
|
|
37
37
|
response = Net::HTTP.start(request_uri.host, request_uri.port, use_ssl: true) do |http|
|
|
38
38
|
http.request request
|
|
39
39
|
end
|
|
@@ -16,9 +16,9 @@ module EspnPub
|
|
|
16
16
|
:position,
|
|
17
17
|
:team_id,
|
|
18
18
|
:date_of_birth,
|
|
19
|
-
:
|
|
20
|
-
:
|
|
21
|
-
:
|
|
19
|
+
:birth_city,
|
|
20
|
+
:birth_state,
|
|
21
|
+
:birth_country,
|
|
22
22
|
:height,
|
|
23
23
|
:weight,
|
|
24
24
|
:debut_year
|
|
@@ -33,14 +33,14 @@ 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
|
|
37
|
-
# @param
|
|
38
|
-
# @param
|
|
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.
|
|
39
39
|
# @param height [String, nil] The player's listed height.
|
|
40
40
|
# @param weight [String, nil] The player's listed weight.
|
|
41
41
|
# @param debut_year [Integer, nil] The year the player made their debut.
|
|
42
42
|
def initialize(id:, sport:, league:, first_name: nil, last_name: nil, position: nil, team_id: nil,
|
|
43
|
-
date_of_birth: nil,
|
|
43
|
+
date_of_birth: nil, birth_city: nil, birth_state: nil, birth_country: nil, height: nil, weight: nil, debut_year: nil)
|
|
44
44
|
@id = id
|
|
45
45
|
@sport = sport
|
|
46
46
|
@league = league
|
|
@@ -49,9 +49,9 @@ module EspnPub
|
|
|
49
49
|
@position = position
|
|
50
50
|
@team_id = team_id
|
|
51
51
|
@date_of_birth = self.class.parse_date_of_birth(date_of_birth)
|
|
52
|
-
@
|
|
53
|
-
@
|
|
54
|
-
@
|
|
52
|
+
@birth_city = birth_city
|
|
53
|
+
@birth_state = birth_state
|
|
54
|
+
@birth_country = birth_country
|
|
55
55
|
@height = height
|
|
56
56
|
@weight = weight
|
|
57
57
|
@debut_year = debut_year
|
|
@@ -85,9 +85,9 @@ module EspnPub
|
|
|
85
85
|
position: athlete_data.dig('position', 'abbreviation'),
|
|
86
86
|
team_id: athlete_data.dig('team', 'id'),
|
|
87
87
|
date_of_birth: parse_date_of_birth(athlete_data['dateOfBirth']),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
birth_city: athlete_data.dig('birthPlace', 'city'),
|
|
89
|
+
birth_state: athlete_data.dig('birthPlace', 'state'),
|
|
90
|
+
birth_country: athlete_data.dig('birthPlace', 'country'),
|
|
91
91
|
height: athlete_data['displayHeight'],
|
|
92
92
|
weight: athlete_data['displayWeight'],
|
|
93
93
|
debut_year: athlete_data['debutYear']
|
|
@@ -35,8 +35,10 @@ module EspnPub
|
|
|
35
35
|
super()
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def self.fetch_by_id(id:, sport:, league:)
|
|
38
|
+
def self.fetch_by_id(id:, sport:, league:, user_agent: nil)
|
|
39
39
|
client = EspnPub::Client.new
|
|
40
|
+
client.user_agent = user_agent if user_agent
|
|
41
|
+
|
|
40
42
|
path = format TEAM_PATH, client.version, sport, league, id
|
|
41
43
|
begin
|
|
42
44
|
team_data = client.send_request(path)['team']
|
|
@@ -75,9 +77,9 @@ module EspnPub
|
|
|
75
77
|
last_name: athlete_data['lastName'],
|
|
76
78
|
position: athlete_data['position']['abbreviation'],
|
|
77
79
|
team_id: id,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
birth_city: athlete_data.dig('birthPlace', 'city'),
|
|
81
|
+
birth_state: athlete_data.dig('birthPlace', 'state'),
|
|
82
|
+
birth_country: athlete_data.dig('birthPlace', 'country'),
|
|
81
83
|
date_of_birth: athlete_data['dateOfBirth'],
|
|
82
84
|
height: athlete_data['height'],
|
|
83
85
|
weight: athlete_data['weight'],
|
data/lib/espn_pub/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: espn_pub
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeffrey Bowman
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: date
|
|
@@ -162,7 +161,6 @@ metadata:
|
|
|
162
161
|
homepage_uri: https://github.com/bowmanje/espn-pub-rb
|
|
163
162
|
source_code_uri: https://github.com/bowmanje/espn-pub-rb
|
|
164
163
|
documentation_uri: https://www.rubydoc.info/gems/espn_pub
|
|
165
|
-
post_install_message:
|
|
166
164
|
rdoc_options: []
|
|
167
165
|
require_paths:
|
|
168
166
|
- lib
|
|
@@ -177,8 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
177
175
|
- !ruby/object:Gem::Version
|
|
178
176
|
version: '0'
|
|
179
177
|
requirements: []
|
|
180
|
-
rubygems_version:
|
|
181
|
-
signing_key:
|
|
178
|
+
rubygems_version: 4.0.20
|
|
182
179
|
specification_version: 4
|
|
183
180
|
summary: A Ruby client for the public ESPN API
|
|
184
181
|
test_files: []
|