Class: YahooStock::Interface::ScripSymbol

Inherits:
YahooStock::Interface show all
Defined in:
lib/yahoo_stock/interface/scrip_symbol.rb

Overview

DESCRIPTION:

Class to generate the right url and interface with yahoo to get Scrip / Stock Symbols

Defined Under Namespace

Classes: ScripSymbolError

Constant Summary

Constants inherited from YahooStock::Interface

BASE_URLS

Instance Attribute Summary collapse

Attributes inherited from YahooStock::Interface

#base_url, #uri_parameters

Instance Method Summary collapse

Methods inherited from YahooStock::Interface

#update

Constructor Details

#initialize(company) ⇒ ScripSymbol

Scrapes the resulting page and gets data in between two points


12
13
14
15
16
17
18
# File 'lib/yahoo_stock/interface/scrip_symbol.rb', line 12

def initialize(company)
  @base_url = BASE_URLS[:scrip_symbol]
  @company = remove_any_space(company)
  @before_element = 'yfi_sym_results'
  @after_element = 'yfi_fp_left_bottom'
  add_observer(self)
end

Instance Attribute Details

#companyObject

Returns the value of attribute company


10
11
12
# File 'lib/yahoo_stock/interface/scrip_symbol.rb', line 10

def company
  @company
end

Instance Method Details

#getObject

Get uri content with the help of get method of the super class


27
28
29
30
# File 'lib/yahoo_stock/interface/scrip_symbol.rb', line 27

def get
  uri
  super()
end

#uriObject

Generate full uri with the help of uri method of the superclass


21
22
23
24
# File 'lib/yahoo_stock/interface/scrip_symbol.rb', line 21

def uri
  @uri_parameters = {:s => @company}
  super()  
end

#valuesObject


32
33
34
# File 'lib/yahoo_stock/interface/scrip_symbol.rb', line 32

def values
  @values ||= get_values
end