Class: SecApi::Objects::DocumentFormatFile
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- SecApi::Objects::DocumentFormatFile
- Defined in:
- lib/sec_api/objects/document_format_file.rb
Overview
Represents a document file within an SEC filing.
DocumentFormatFile objects contain metadata about individual documents within a filing, such as the main filing document, exhibits, and attachments. All instances are immutable (frozen).
Direct Known Subclasses
Class Method Summary collapse
-
.from_api(data) ⇒ DocumentFormatFile
Creates a DocumentFormatFile from API response data.
Class Method Details
.from_api(data) ⇒ DocumentFormatFile
Creates a DocumentFormatFile from API response data.
Normalizes camelCase keys from the API to snake_case format.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sec_api/objects/document_format_file.rb', line 38 def self.from_api(data) data[:url] = data.delete(:documentUrl) if data.key?(:documentUrl) # API sometimes returns whitespace (including non-breaking spaces) for size # Use POSIX [[:space:]] to match all unicode whitespace including NBSP [:size, "size"].each do |key| if data.key?(key) && data[key].is_a?(String) && data[key].match?(/\A[[:space:]]*\z/) data.delete(key) end end new(data) end |