Class: Reuters::Client::Search::Equity
- Defined in:
- lib/reuters/client/search/equity.rb
Overview
All Equity Search XML Requests require that the appropriate xmlns attribute is present on elements inside the request element. This class uses the before_request hook to inject the appropriate attribute.
Performs a Equity Search Reuters API request. Equity searches are intended to vary in complexity but allow you to retrieve financial information about a company on a specific exchange.
Direct Known Subclasses
Instance Method Summary collapse
-
#data_type ⇒ String
Retrieve the correctly formatted Namespace Data Type for an Equity-based Search Reuters Request.
-
#initialize ⇒ Equity
constructor
A new instance of Equity.
-
#query_spec ⇒ String
Retrieve the correctly formatted Namespace Query Specification for an Equity-based Search.
Methods inherited from Base
#after_request, #before_request, #client, #method_missing, #request
Constructor Details
#initialize ⇒ Equity
Returns a new instance of Equity.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/reuters/client/search/equity.rb', line 15 def initialize # process equity request objects before they are sent. before_request do |req| if req.key?(:query_header) req.attributes({ query_header: { 'xmlns' => data_type } }, false) end [:filter, :query].each do |section| if req.key?(section) sec = req.send(section) sec.keys.each do |key| # injext xmlns property only if it does not already exist unless sec.attribute_key? key, 'xmlns' sec.attributes({ key => { 'xmlns' => query_spec } }, false) end sec[key].keys.each do |type| # injext xmlns property only if it does not already exist unless sec[key].attribute_key? type, 'xmlns' sec[key].attributes({ type => { 'xmlns' => data_type } }, false) end end end end end req end super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Reuters::Client::Base
Instance Method Details
#data_type ⇒ String
Retrieve the correctly formatted Namespace Data Type for an Equity-based Search Reuters Request.
54 55 56 |
# File 'lib/reuters/client/search/equity.rb', line 54 def data_type ns_definition(:query_spec_datatypes) end |
#query_spec ⇒ String
Retrieve the correctly formatted Namespace Query Specification for an Equity-based Search.
62 63 64 |
# File 'lib/reuters/client/search/equity.rb', line 62 def query_spec ns_definition(:equity_quote, :query_spec, 1) end |