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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bef1ef7f5050a573909c0bbaece14d11df23e78c
4
- data.tar.gz: 622b8196510c5abfebf07c5c62a6d4843c381087
3
+ metadata.gz: f9526adbe8a6f3a7fdfbb99aaaebf7ce50d8b6b2
4
+ data.tar.gz: 466348e650f976fc12f828af43cf40927f9d0bed
5
5
  SHA512:
6
- metadata.gz: 69a8b0393098fc4f9928b02e48e0a18d7319151f25f7283f4525bb7c6ee48da20e8e09cde3768b73c577dbf10f180c233b9a7dbc2596fe95139f2aa9b6103b8b
7
- data.tar.gz: 0b12bb6c108ce0db4cc607118145cf6d714eabd3947057991eb6a67973690871ccf25278532b0b3ed40a4747fe0201421c7b707a758e1c4543c7ee4b2dcd658c
6
+ metadata.gz: 2dc9dc73170c24c675122080c2ed1dfdd90830fe542b5a677dd8d221b86eadf7138e8031dd018c5ebe3d2b19c61e36499d73a8f48a17d7cd1f03211b5d688f4a
7
+ data.tar.gz: 54cbfa35b41b09b1f21e558ab9efdad8a4ca06cde2c6c28cf5915e850afe01c24f287485289fbc41b0b1cb618f2f248b8b50c7d24e9cfdbda19f0f979460d633
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.1.13)
4
+ sportradar-api (0.1.14)
5
5
  activesupport
6
6
  httparty (>= 0.13.3)
7
7
 
@@ -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 = 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 position_name
53
+ def get_position_name
50
54
  positions = {"G" => "Goalie", "D" => "Defender", "M" => "Midfielder", "F" => "Forward"}
51
- positions[position] if position
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 age
71
+ def get_age
60
72
  now = Time.now.utc.to_date
61
- dob = @birthdate.to_date
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
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.1.13"
3
+ VERSION = "0.1.14"
4
4
  end
5
5
  end
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.13
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-29 00:00:00.000000000 Z
11
+ date: 2016-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler