sportradar-api 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sportradar/api/soccer/player.rb +23 -6
- data/lib/sportradar/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9526adbe8a6f3a7fdfbb99aaaebf7ce50d8b6b2
|
4
|
+
data.tar.gz: 466348e650f976fc12f828af43cf40927f9d0bed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dc9dc73170c24c675122080c2ed1dfdd90830fe542b5a677dd8d221b86eadf7138e8031dd018c5ebe3d2b19c61e36499d73a8f48a17d7cd1f03211b5d688f4a
|
7
|
+
data.tar.gz: 54cbfa35b41b09b1f21e558ab9efdad8a4ca06cde2c6c28cf5915e850afe01c24f287485289fbc41b0b1cb618f2f248b8b50c7d24e9cfdbda19f0f979460d633
|
data/Gemfile.lock
CHANGED
@@ -2,19 +2,22 @@ module Sportradar
|
|
2
2
|
module Api
|
3
3
|
class Soccer::Player < Data
|
4
4
|
|
5
|
-
attr_accessor :id, :first_name, :last_name, :country_code, :country, :reference_id, :full_first_name, :full_last_name, :position, :started, :jersey_number, :tactical_position, :tactical_order, :statistics, :preferred_foot, :birthdate, :height_in, :weight_lb, :height_cm, :weight_kg, :teams, :response, :rank, :total, :statistics, :last_modified, :age
|
5
|
+
attr_accessor :id, :first_name, :last_name, :country_code, :country, :reference_id, :full_first_name, :full_last_name, :position, :started, :jersey_number, :tactical_position, :tactical_order, :statistics, :preferred_foot, :birthdate, :height_in, :weight_lb, :height_cm, :weight_kg, :teams, :response, :rank, :total, :statistics, :last_modified, :age, :height_ft, :position_name, :tactical_position_name, :name, :full_name
|
6
6
|
|
7
7
|
def initialize(data)
|
8
8
|
@response = data
|
9
9
|
@id = data["id"]
|
10
10
|
@first_name = data["first_name"]
|
11
11
|
@last_name = data["last_name"]
|
12
|
+
@name = name
|
12
13
|
@country_code = data["country_code"]
|
13
14
|
@country = data["country"]
|
14
15
|
@reference_id = data["reference_id"]
|
15
16
|
@full_first_name = data["full_first_name"]
|
16
17
|
@full_last_name = data["full_last_name"]
|
18
|
+
@full_name = full_name
|
17
19
|
@position = data["position"]
|
20
|
+
@position_name = get_position_name
|
18
21
|
@started = data["started"]
|
19
22
|
@jersey_number = data["jersey_number"]
|
20
23
|
@tactical_position = data["tactical_position"]
|
@@ -25,10 +28,11 @@ module Sportradar
|
|
25
28
|
@preferred_foot = data["preferred_foot"]
|
26
29
|
@birthdate = data["birthdate"]
|
27
30
|
@height_in = data["height_in"]
|
31
|
+
@height_ft = get_height_ft
|
28
32
|
@weight_lb = data["weight_lb"]
|
29
33
|
@height_cm = data["height_cm"]
|
30
34
|
@weight_kg = data["weight_kg"]
|
31
|
-
@age =
|
35
|
+
@age = get_age
|
32
36
|
set_teams
|
33
37
|
|
34
38
|
@rank = data["rank"]
|
@@ -46,9 +50,17 @@ module Sportradar
|
|
46
50
|
full == " " ? name : full
|
47
51
|
end
|
48
52
|
|
49
|
-
def
|
53
|
+
def get_position_name
|
50
54
|
positions = {"G" => "Goalie", "D" => "Defender", "M" => "Midfielder", "F" => "Forward"}
|
51
|
-
|
55
|
+
if position.present?
|
56
|
+
positions[position]
|
57
|
+
elsif teams.present?
|
58
|
+
teams.map do |team|
|
59
|
+
if team.position.present?
|
60
|
+
positions[team.position]
|
61
|
+
end
|
62
|
+
end.uniq.join(", ")
|
63
|
+
end
|
52
64
|
end
|
53
65
|
|
54
66
|
def tactical_position_name
|
@@ -56,12 +68,17 @@ module Sportradar
|
|
56
68
|
tactical_positions[tactical_position] if tactical_position
|
57
69
|
end
|
58
70
|
|
59
|
-
def
|
71
|
+
def get_age
|
60
72
|
now = Time.now.utc.to_date
|
61
|
-
dob =
|
73
|
+
dob = birthdate.to_date
|
62
74
|
now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
|
63
75
|
end
|
64
76
|
|
77
|
+
def get_height_ft
|
78
|
+
feet, inches = height_in.to_i.divmod(12)
|
79
|
+
"#{feet}' #{inches}\""
|
80
|
+
end
|
81
|
+
|
65
82
|
private
|
66
83
|
|
67
84
|
def set_teams
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportradar-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|