Sha256: 84e1c2fd3deaf36178f3a8eb7aa722ae244903cce6aac460615385bdd0a01e00
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true module Awis module API class Base include Utils::Extra attr_reader :arguments, :response_body def fetch(arguments = {}) validation_arguments!(arguments) loading_response_body self end def request_description_params arguments[:descriptions].to_s.capitalize end def parsed_body @parsed_body ||= MultiXml.parse(response_body) end def loading_response_body @response_body = Awis::Connection.new.get(params) end def root_node_name "#{action_name}Response" end def action_name self.class.name.split(/\:\:/)[-1] end def load_request_uri(params) collection = Awis::Connection.new collection.set_params(params) collection.send(:uri) end def before_validation_arguments(arguments) raise ArgumentError, "Invalid arguments. should be like { url: 'site.com' }" unless arguments.is_a?(Hash) raise ArgumentError, 'Invalid arguments. the url must be configured.' unless arguments.key?(:url) end class << self def loading_data_from_xml(xml_file_path) MultiXml.parse(File.new(xml_file_path)) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
awis-sdk-ruby-2.1.0 | lib/awis/api/base.rb |