class Oca::BaseClient

Constants

BASE_WSDL_URL
FALSE_STRING

Attributes

client[R]
password[RW]
username[RW]

Public Class Methods

new(username, password) click to toggle source
# File lib/oca-epak/base_client.rb, line 9
def initialize(username, password)
  @username = username
  @password = password
end

Protected Instance Methods

parse_result(response, method) click to toggle source
# File lib/oca-epak/base_client.rb, line 16
def parse_result(response, method)
  method_response = "#{method}_response".to_sym
  method_result = "#{method}_result".to_sym
  if body = response.body[method_response]
    body[method_result]
  end
end
parse_results_table(response, method) click to toggle source

@return [Array, nil]

# File lib/oca-epak/base_client.rb, line 25
def parse_results_table(response, method)
  if result = parse_result(response, method)
    if result[:diffgram][:new_data_set]
      table = result[:diffgram][:new_data_set][:table]
      table.is_a?(Hash) ? [table] : table
    else
      raise Oca::Errors::BadRequest.new("Oca WS responded with:\n#{response.body}")
    end
  end
end