Sha256: 85ced464b4d82140c5eaf81d8c6f394756462e97e87db8de22e26e2877693d3c

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

module Shipcloud
  module Request
    class Info
      attr_accessor :http_method, :api_url, :api_key, :data, :affiliate_id

      def initialize(http_method, api_url, api_key, data, affiliate_id)
        @api_key      = api_key
        @http_method  = http_method
        @api_url      = api_url
        @data         = data
        @affiliate_id = affiliate_id
      end

      def url
        "/#{API_VERSION}/#{api_url}"
      end

      def path_with_params(path, params)
        if params.empty?
          path
        else
          encoded_params = URI.encode_www_form(params)
          [path, encoded_params].join("?")
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shipcloud-0.12.0 lib/shipcloud/request/info.rb