Class: YFi::Quote

Inherits:
Object
  • Object
show all
Defined in:
lib/y_fi/quote.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Quote

Returns a new instance of Quote.



8
9
10
11
12
13
# File 'lib/y_fi/quote.rb', line 8

def initialize(args)
  args.each do |key, val|
    self.public_send("#{key}=", val)
  end
  self.ticker = self.ticker.to_s.upcase
end

Instance Attribute Details

#issuer_nameObject

Returns the value of attribute issuer_name.



3
4
5
# File 'lib/y_fi/quote.rb', line 3

def issuer_name
  @issuer_name
end

#priceObject

Returns the value of attribute price.



3
4
5
# File 'lib/y_fi/quote.rb', line 3

def price
  @price
end

#tickerObject

Returns the value of attribute ticker.



3
4
5
# File 'lib/y_fi/quote.rb', line 3

def ticker
  @ticker
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/y_fi/quote.rb', line 3

def updated_at
  @updated_at
end

Class Method Details

.find_by_ticker(ticker) ⇒ Api::ExternalFund

Examples:

Api::ExternalFund.find_by_ticker(‘AAPL’)

Parameters:

  • ticker (String)

Returns:

  • (Api::ExternalFund)


18
19
20
# File 'lib/y_fi/quote.rb', line 18

def self.find_by_ticker(ticker)
  QuoteCollection.new([ticker]).first
end