Sha256: bc229bf4f4d574b7b9854f4d877e603cb3723adc4f5435a8fca410776b7c05fe

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

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)
        builder = Nokogiri::XML::Builder.new do |xml|
          xml.sharingResponse {
            xml.action action
            xml.note note
          }
        end.to_xml
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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