Class: Rapa::Responses::LookupBrowseNodeResponse

Inherits:
SingleResourceResponse show all
Defined in:
lib/rapa/responses/single_resource_response/lookup_browse_node_response.rb

Instance Method Summary collapse

Methods inherited from BaseResponse

#body, #headers, #initialize, #status

Constructor Details

This class inherits a constructor from Rapa::Responses::BaseResponse

Instance Method Details

#errorRapa::Error?

Returns:



5
6
7
8
9
# File 'lib/rapa/responses/single_resource_response/lookup_browse_node_response.rb', line 5

def error
  if value = body.dig("BrowseNodeLookupErrorResponse", "Error")
    ::Rapa::Error.new(value)
  end
end

#has_error?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/rapa/responses/single_resource_response/lookup_browse_node_response.rb', line 12

def has_error?
  !error.nil?
end

#has_valid_request?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/rapa/responses/single_resource_response/lookup_browse_node_response.rb', line 17

def has_valid_request?
  body.dig("BrowseNodeLookupResponse", "BrowseNodes", "Request", "IsValid") == "True"
end

#response_group(group) ⇒ Array<Rapa::Resources::BrowseNodeResource>?

Returns:



22
23
24
25
26
27
28
29
# File 'lib/rapa/responses/single_resource_response/lookup_browse_node_response.rb', line 22

def response_group(group)
  item = sources.find { |source| source["Type"] == group }
  unless item.nil?
    item["TopItem"].map do |source|
      resource_class.new(source)
    end
  end
end