Sha256: 8f8b0089aa78f287a1a41a5e9f76d032b59e40859f5d7b7a399f36fb6c2ed714

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

module MWS
  # Connection
  class Connection
    attr_reader :host, :aws_access_key_id, :aws_secret_access_key, :seller_id, :mws_auth_token

    # rubocop:disable all
    def initialize(options = {})
      @host = options[:host] || 'mws.amazonservices.com'
      @aws_access_key_id = options[:aws_access_key_id] || MWS.aws_access_key_id || ENV['AWS_ACCESS_KEY_ID']
      @aws_secret_access_key = options[:aws_secret_access_key] || MWS.aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY']
      @mws_auth_token = options[:mws_auth_token] || ENV['MWS_AUTH_TOKEN']
      @seller_id = options[:seller_id]

      if @aws_access_key_id.to_s.empty? || @aws_secret_access_key.to_s.empty? || @seller_id.to_s.empty?
        fail(ArgumentError, 'You must provide :aws_access_key_id, :aws_secret_access_key, :seller_id and :mws_auth_token')
      end
    end

    # Map APIS
    def feeds
      @fees ||= MWS::API::Feeds.new(self)
    end

    def fulfillment_inbound_shipment
      @fis ||= MWS::API::FulfillmentInboundShipment.new(self)
    end

    def fulfillment_inventory
      @fi ||= MWS::API::FulfillmentInventory.new(self)
    end

    def fulfillment_outbound_shipment
      @fos ||= MWS::API::FulfillmentOutboundShipment.new(self)
    end

    def orders
      @orders ||= MWS::API::Orders.new(self)
    end

    def products
      @products ||= MWS::API::Products.new(self)
    end

    def recommendations
      @recommendations ||= MWS::API::Recommendations.new(self)
    end

    def reports
      @reports ||= MWS::API::Reports.new(self)
    end

    def sellers
      @sellers ||= MWS::API::Sellers.new(self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mws_rb-0.0.6 lib/mws/connection.rb