Sha256: d5c15991109823b1bbdeee3eba4872fafb10745c5b05973109f70b5ed3c77cc6

Contents?: true

Size: 1.36 KB

Versions: 7

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

require "hashie"

module ShipEngine
  module Domain
    class CarriersAccounts
      def initialize
        @client = ShipEngine::Client.new
      end

      def connect_carrier_account(carrier_name:, params: {})
        response = @client.post(
          path: "#{ShipEngine::Constants::PATHS.v1.carriers_accounts.root}/#{carrier_name}",
          options: params
        )

        Hashie::Mash.new(response.body)
      end

      def disconnect_carrier_account(carrier_name:, carrier_id:, params: {})
        response = @client.delete(
          path: "#{ShipEngine::Constants::PATHS.v1.carriers_accounts.root}/#{carrier_name}/#{carrier_id}",
          options: params
        )

        Hashie::Mash.new(response.body)
      end

      def carrier_settings(carrier_name:, carrier_id:, params: {})
        response = @client.get(
          path: "#{ShipEngine::Constants::PATHS.v1.carriers_accounts.root}/#{carrier_name}/#{carrier_id}/settings",
          options: params
        )

        Hashie::Mash.new(response.body)
      end

      def update_carrier_settings(carrier_name:, carrier_id:, params: {})
        response = @client.put(
          path: "#{ShipEngine::Constants::PATHS.v1.carriers_accounts.root}/#{carrier_name}/#{carrier_id}/settings",
          options: params
        )

        Hashie::Mash.new(response.body)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shipengine_ruby-0.0.7 lib/shipengine/domains/carriers_accounts.rb
shipengine_ruby-0.0.6 lib/shipengine/domains/carriers_accounts.rb
shipengine_ruby-0.0.5 lib/shipengine/domains/carriers_accounts.rb
shipengine_ruby-0.0.4 lib/shipengine/domains/carriers_accounts.rb
shipengine_ruby-0.0.3 lib/shipengine/domains/carriers_accounts.rb
shipengine_ruby-0.0.2 lib/shipengine/domains/carriers_accounts.rb
shipengine_ruby-0.0.1 lib/shipengine/domains/carriers_accounts.rb