class RealPage::DocumentParser::Picklist

Parse a Picklist response

Attributes

soap_action[R]

Public Class Methods

new(soap_action) click to toggle source

@param soap_action [String] the action requested

# File lib/real_page/document_parser/picklist.rb, line 10
def initialize(soap_action)
  @soap_action = soap_action
end

Private Instance Methods

items(body) click to toggle source
# File lib/real_page/document_parser/picklist.rb, line 31
def items(body)
  response_key = "#{soap_action.downcase}Response"
  result_key = "#{soap_action.downcase}Result"
  body[response_key][result_key][soap_action]['Contents']
end
parse_body(body) click to toggle source

@param body [Hash<String, Object>] the body of the XML response parsed

into a Hash

@return [Array<RealPage::Model::PicklistItem>] the pick list items

parsed from the response

@raise [RealPage::Error::Base] if the response is invalid

# File lib/real_page/document_parser/picklist.rb, line 23
def parse_body(body)
  Utils::ArrayFetcher.new(
    hash: items(body),
    key: 'PicklistItem',
    model: Model::PicklistItem
  ).fetch
end