Sha256: 05323c19eedc48d503932fb305c8250038bddaceebc71528e31148c767aa279c

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require "hashie"

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

      def list_tags(params: {})
        response = @client.get(
          path: ShipEngine::Constants::PATHS.v1.tags.root,
          options: params
        )

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

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

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

      def delete_tag(tag_name:, params: {})
        response = @client.delete(
          path: "#{ShipEngine::Constants::PATHS.v1.tags.root}/#{tag_name}",
          options: params
        )

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

      def update_tag(tag_name:, new_tag_name:, params: {})
        response = @client.put(
          path: "#{ShipEngine::Constants::PATHS.v1.tags.root}/#{tag_name}/#{new_tag_name}",
          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/tags.rb
shipengine_ruby-0.0.6 lib/shipengine/domains/tags.rb
shipengine_ruby-0.0.5 lib/shipengine/domains/tags.rb
shipengine_ruby-0.0.4 lib/shipengine/domains/tags.rb
shipengine_ruby-0.0.3 lib/shipengine/domains/tags.rb
shipengine_ruby-0.0.2 lib/shipengine/domains/tags.rb
shipengine_ruby-0.0.1 lib/shipengine/domains/tags.rb