Class: SecApi::Objects::FulltextResult

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/sec_api/objects/fulltext_result.rb

Overview

Represents a full-text search result from SEC EDGAR filings.

FulltextResult objects are returned from full-text search queries and contain metadata about filings that match search terms. All instances are immutable (frozen).

Examples:

Full-text search results

results = client.query.fulltext("merger acquisition")
results.each do |result|
  puts "#{result.ticker}: #{result.description}"
  puts "Filed on: #{result.filed_on}"
  puts "URL: #{result.url}"
end

See Also:

Class Method Summary collapse

Class Method Details

.from_api(data) ⇒ FulltextResult

Creates a FulltextResult from API response data.

Normalizes camelCase keys from the API to snake_case format.

Examples:

Create from API response

data = {
  cik: "0000320193",
  ticker: "AAPL",
  companyNameLong: "Apple Inc.",
  formType: "10-K",
  filingUrl: "https://sec.gov/...",
  type: "10-K",
  description: "Annual report",
  filedAt: "2024-01-15"
}
result = FulltextResult.from_api(data)
result.company_name_long  # => "Apple Inc."

Parameters:

  • data (Hash)

    API response hash with result data

Returns:



56
57
58
59
60
61
62
63
# File 'lib/sec_api/objects/fulltext_result.rb', line 56

def self.from_api(data)
  data[:company_name_long] = data.delete(:companyNameLong) if data.key?(:companyNameLong)
  data[:form_type] = data.delete(:formType) if data.key?(:formType)
  data[:url] = data.delete(:filingUrl) if data.key?(:filingUrl)
  data[:filed_on] = data.delete(:filedAt) if data.key?(:filedAt)

  new(data)
end