Sha256: 58215f957ed31b86d12b618136741c76f6e3f794e7e549727ebd18ba2a3f4eb7

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require 'portfolio_manager/rest/request'

module PortfolioManager
  module REST
    ##
    # Utilities used throughout REST Client
    module Utils
      private

      ##
      # @param [String] path
      # @param [Hash] options
      def perform_get_request(path, options = {})
        perform_request(:get, path, options)
      end

      ##
      # @param [String] path
      # @param [Hash] options
      def perform_post_request(path, options = {})
        perform_request(:post, path, options)
      end

      ##
      # @param [Symbol, String] request_method
      # @param [String] path
      # @param [Hash] options
      def perform_request(request_method, path, options = {})
        PortfolioManager::REST::Request.new(
          self,
          request_method,
          path,
          options
        ).perform
      end

      def request_response_xml(action, note)
        Nokogiri::XML::Builder.new do |xml|
          xml.sharingResponse do
            xml.action action
            xml.note note
          end
        end.to_xml
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
portfolio_manager-0.5.0 lib/portfolio_manager/rest/utils.rb