Class: CapitalIQ::ApiResponse::IdentifierResultGroup
- Inherits:
-
Object
- Object
- CapitalIQ::ApiResponse::IdentifierResultGroup
- Defined in:
- lib/capital-iq/api_response.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
- #<<(result) ⇒ Object
- #[](header) ⇒ Object
- #headers ⇒ Object
-
#initialize(identifier) ⇒ IdentifierResultGroup
constructor
A new instance of IdentifierResultGroup.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(identifier) ⇒ IdentifierResultGroup
Returns a new instance of IdentifierResultGroup.
5 6 7 8 9 |
# File 'lib/capital-iq/api_response.rb', line 5 def initialize(identifier) @identifier = identifier @header_map = {} @results = [] end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/capital-iq/api_response.rb', line 4 def identifier @identifier end |
Instance Method Details
#<<(result) ⇒ Object
10 11 12 13 14 |
# File 'lib/capital-iq/api_response.rb', line 10 def <<(result) raise "Result contains wrong identifier" if result.Identifier != self.identifier @results << result (result.Headers || []).each { |h| @header_map[h] = result } end |
#[](header) ⇒ Object
19 20 21 |
# File 'lib/capital-iq/api_response.rb', line 19 def [](header) @header_map[header][header] end |
#headers ⇒ Object
15 16 17 |
# File 'lib/capital-iq/api_response.rb', line 15 def headers @header_map.keys end |
#to_hash ⇒ Object
23 24 25 |
# File 'lib/capital-iq/api_response.rb', line 23 def to_hash Hash[self.headers.collect { |h| [h, self[h]] }] end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/capital-iq/api_response.rb', line 27 def to_s to_hash().to_s() end |