Class: SecApi::Mapping
- Inherits:
-
Object
- Object
- SecApi::Mapping
- Defined in:
- lib/sec_api/mapping.rb
Overview
Mapping proxy for entity resolution endpoints
All mapping methods return immutable Entity objects (not raw hashes). This ensures thread safety and a consistent API surface.
Instance Method Summary collapse
-
#cik(cik) ⇒ Entity
Resolve CIK number to company entity.
-
#cusip(cusip) ⇒ Entity
Resolve CUSIP identifier to company entity.
-
#initialize(client) ⇒ SecApi::Mapping
constructor
private
Creates a new Mapping proxy instance.
-
#name(name) ⇒ Entity
Resolve company name to entity.
-
#ticker(ticker) ⇒ Entity
Resolve ticker symbol to company entity.
Constructor Details
#initialize(client) ⇒ SecApi::Mapping
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a new Mapping proxy instance.
Mapping instances are obtained via Client#mapping and cached for reuse. Direct instantiation is not recommended.
23 24 25 |
# File 'lib/sec_api/mapping.rb', line 23 def initialize(client) @_client = client end |
Instance Method Details
#cik(cik) ⇒ Entity
Resolve CIK number to company entity
CIK identifiers are normalized to 10 digits with leading zeros before making the API request. This allows flexible input formats:
-
“320193” -> “0000320193”
-
“00320193” -> “0000320193”
-
320193 (integer) -> “0000320193”
60 61 62 63 64 65 |
# File 'lib/sec_api/mapping.rb', line 60 def cik(cik) validate_identifier!(cik, "CIK") normalized = normalize_cik(cik) response = @_client.connection.get("/mapping/cik/#{encode_path(normalized)}") Objects::Entity.from_api(response.body) end |
#cusip(cusip) ⇒ Entity
Resolve CUSIP identifier to company entity
75 76 77 78 79 |
# File 'lib/sec_api/mapping.rb', line 75 def cusip(cusip) validate_identifier!(cusip, "CUSIP") response = @_client.connection.get("/mapping/cusip/#{encode_path(cusip)}") Objects::Entity.from_api(response.body) end |