Class: StockApiWrapper::Stock
- Inherits:
-
Object
- Object
- StockApiWrapper::Stock
- Defined in:
- lib/stock_api_wrapper/stock.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#symbols_returned ⇒ Object
readonly
Returns the value of attribute symbols_returned.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Stock
constructor
A new instance of Stock.
Constructor Details
#initialize(attributes) ⇒ Stock
Returns a new instance of Stock.
10 11 12 13 14 |
# File 'lib/stock_api_wrapper/stock.rb', line 10 def initialize(attributes) @symbols_returned = attributes["symbols_returned"] @base = attributes["base"] @data = attributes["data"] end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
9 10 11 |
# File 'lib/stock_api_wrapper/stock.rb', line 9 def base @base end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/stock_api_wrapper/stock.rb', line 9 def data @data end |
#symbols_returned ⇒ Object (readonly)
Returns the value of attribute symbols_returned.
9 10 11 |
# File 'lib/stock_api_wrapper/stock.rb', line 9 def symbols_returned @symbols_returned end |
Class Method Details
.find(symbols_returned) ⇒ Object
16 17 18 19 20 |
# File 'lib/stock_api_wrapper/stock.rb', line 16 def self.find(symbols_returned) response = Faraday.get("#{API_URL}") attributes = JSON.parse(response.body) new(attributes) end |