Sha256: be578ecae9a4c31faf595928e1e701e6ccb9135d6a5dd5c91becd29f87e8c53a

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

require "big_commerce/management_api/endpoint"

module BigCommerce
  module ManagementAPI
    class Segments < Endpoint
      PATH = "segments"
      RESULT_INSTANCE = Segment

      def create(*segments)
        segments.flatten!

        POST(PATH, segments.map(&:to_h))
      end

      def delete(*ids)
        ids.flatten!

        DELETE(
          PATH,
          with_in_param({:id => ids}, :id)
        )
      end

      def get(options = {})
        GET(
          PATH,
          with_in_param(
            options,
            :id
          )
        )
      end

      def update(*segments)
        segments.flatten!

        PUT(PATH, segments.map(&:to_h))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
big_commerce-management_api-0.0.1 lib/big_commerce/management_api/segments.rb