Class: OpenfigiRuby::MappingResult

Inherits:
Struct
  • Object
show all
Defined in:
lib/openfigi_ruby/mapping_result.rb

Overview

Result for a single job in a bulk mapping request.

On success, #data is an array of FigiResult objects and #warning is nil. When no match is found, #data is nil and #warning holds the API message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataArray<FigiResult>? (readonly)

Returns matched instruments, or nil when no match was found.

Returns:

  • (Array<FigiResult>, nil)

    matched instruments, or nil when no match was found



13
14
15
16
17
18
19
# File 'lib/openfigi_ruby/mapping_result.rb', line 13

MappingResult = Struct.new(:data, :warning, keyword_init: true) do
  # Returns true if the job matched at least one instrument.
  # @return [Boolean]
  def found?
    !data.nil? && !data.empty?
  end
end

#warningString? (readonly)

Returns API warning message when no identifier was found.

Returns:

  • (String, nil)

    API warning message when no identifier was found



13
14
15
16
17
18
19
# File 'lib/openfigi_ruby/mapping_result.rb', line 13

MappingResult = Struct.new(:data, :warning, keyword_init: true) do
  # Returns true if the job matched at least one instrument.
  # @return [Boolean]
  def found?
    !data.nil? && !data.empty?
  end
end

Instance Method Details

#found?Boolean

Returns true if the job matched at least one instrument.

Returns:

  • (Boolean)


16
17
18
# File 'lib/openfigi_ruby/mapping_result.rb', line 16

def found?
  !data.nil? && !data.empty?
end