Class: MLB::Transaction
- Inherits:
-
Struct
- Object
- Struct
- MLB::Transaction
- Defined in:
- lib/mlb/transaction.rb
Instance Attribute Summary collapse
-
#conditional_sw ⇒ Object
Returns the value of attribute conditional_sw.
-
#effective_date ⇒ Object
Returns the value of attribute effective_date.
-
#final_asset ⇒ Object
Returns the value of attribute final_asset.
-
#final_asset_type ⇒ Object
Returns the value of attribute final_asset_type.
-
#from_team ⇒ Object
Returns the value of attribute from_team.
-
#from_team_id ⇒ Object
Returns the value of attribute from_team_id.
-
#name_display_first_last ⇒ Object
Returns the value of attribute name_display_first_last.
-
#name_display_last_first ⇒ Object
Returns the value of attribute name_display_last_first.
-
#name_sort ⇒ Object
Returns the value of attribute name_sort.
-
#note ⇒ Object
Returns the value of attribute note.
-
#orig_asset ⇒ Object
Returns the value of attribute orig_asset.
-
#orig_asset_type ⇒ Object
Returns the value of attribute orig_asset_type.
-
#player ⇒ Object
Returns the value of attribute player.
-
#player_id ⇒ Object
Returns the value of attribute player_id.
-
#resolution_cd ⇒ Object
Returns the value of attribute resolution_cd.
-
#resolution_date ⇒ Object
Returns the value of attribute resolution_date.
-
#team ⇒ Object
Returns the value of attribute team.
-
#team_id ⇒ Object
Returns the value of attribute team_id.
-
#trans_date ⇒ Object
Returns the value of attribute trans_date.
-
#trans_date_cd ⇒ Object
Returns the value of attribute trans_date_cd.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
-
#type ⇒ Object
Returns the value of attribute type.
-
#type_cd ⇒ Object
Returns the value of attribute type_cd.
Class Method Summary collapse
Instance Attribute Details
#conditional_sw ⇒ Object
Returns the value of attribute conditional_sw
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def conditional_sw @conditional_sw end |
#effective_date ⇒ Object
Returns the value of attribute effective_date
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def effective_date @effective_date end |
#final_asset ⇒ Object
Returns the value of attribute final_asset
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def final_asset @final_asset end |
#final_asset_type ⇒ Object
Returns the value of attribute final_asset_type
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def final_asset_type @final_asset_type end |
#from_team ⇒ Object
Returns the value of attribute from_team
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def from_team @from_team end |
#from_team_id ⇒ Object
Returns the value of attribute from_team_id
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def from_team_id @from_team_id end |
#name_display_first_last ⇒ Object
Returns the value of attribute name_display_first_last
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def name_display_first_last @name_display_first_last end |
#name_display_last_first ⇒ Object
Returns the value of attribute name_display_last_first
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def name_display_last_first @name_display_last_first end |
#name_sort ⇒ Object
Returns the value of attribute name_sort
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def name_sort @name_sort end |
#note ⇒ Object
Returns the value of attribute note
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def note @note end |
#orig_asset ⇒ Object
Returns the value of attribute orig_asset
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def orig_asset @orig_asset end |
#orig_asset_type ⇒ Object
Returns the value of attribute orig_asset_type
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def orig_asset_type @orig_asset_type end |
#player ⇒ Object
Returns the value of attribute player
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def player @player end |
#player_id ⇒ Object
Returns the value of attribute player_id
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def player_id @player_id end |
#resolution_cd ⇒ Object
Returns the value of attribute resolution_cd
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def resolution_cd @resolution_cd end |
#resolution_date ⇒ Object
Returns the value of attribute resolution_date
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def resolution_date @resolution_date end |
#team ⇒ Object
Returns the value of attribute team
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def team @team end |
#team_id ⇒ Object
Returns the value of attribute team_id
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def team_id @team_id end |
#trans_date ⇒ Object
Returns the value of attribute trans_date
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def trans_date @trans_date end |
#trans_date_cd ⇒ Object
Returns the value of attribute trans_date_cd
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def trans_date_cd @trans_date_cd end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def transaction_id @transaction_id end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def type @type end |
#type_cd ⇒ Object
Returns the value of attribute type_cd
5 6 7 |
# File 'lib/mlb/transaction.rb', line 5 def type_cd @type_cd end |
Class Method Details
.all(start_date: Date.today, end_date: Date.today) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mlb/transaction.rb', line 10 def self.all(start_date: Date.today, end_date: Date.today) sport_code = "'mlb'" start_date = Date.parse(start_date.to_s).strftime("%Y%m%d") end_date = Date.parse(end_date.to_s).strftime("%Y%m%d") params = {sport_code:, start_date:, end_date:} query_string = URI.encode_www_form(params) response = CLIENT.get("named.transaction_all.bam?#{query_string}") transactions = response.fetch(:transaction_all, {}).fetch(:queryResults, {}).fetch(:row, []) transactions.collect { |transaction| Transaction.new(**transaction) } end |