Sha256: af2dca100565880e30830a097b6097015b704064ffa054f19d2ac4491984d13c

Contents?: true

Size: 725 Bytes

Versions: 18

Compression:

Stored size: 725 Bytes

Contents

module Octobat
  class Coupon < APIResource
    extend Octobat::APIOperations::List
    include Octobat::APIOperations::Create
    include Octobat::APIOperations::Update

    def activate
      response, api_key = Octobat.request(:patch, activate_url, @api_key)
      refresh_from(response, api_key)
    end

    def unactivate
      response, api_key = Octobat.request(:patch, unactivate_url, @api_key)
      refresh_from(response, api_key)
    end

    def delete
      response, api_key = Octobat.request(:delete, url, @api_key)
      refresh_from(response, api_key)
    end

    private

      def activate_url
        url + '/activate'
      end

      def unactivate_url
        url + '/unactivate'
      end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
octobat-2.0.18 lib/octobat/coupon.rb
octobat-2.0.17 lib/octobat/coupon.rb
octobat-2.0.16 lib/octobat/coupon.rb
octobat-2.0.15 lib/octobat/coupon.rb
octobat-2.0.14 lib/octobat/coupon.rb
octobat-2.0.12 lib/octobat/coupon.rb
octobat-2.0.11 lib/octobat/coupon.rb
octobat-2.0.10 lib/octobat/coupon.rb
octobat-2.0.9 lib/octobat/coupon.rb
octobat-2.0.8 lib/octobat/coupon.rb
octobat-2.0.7 lib/octobat/coupon.rb
octobat-2.0.6 lib/octobat/coupon.rb
octobat-2.0.5 lib/octobat/coupon.rb
octobat-2.0.4 lib/octobat/coupon.rb
octobat-2.0.3 lib/octobat/coupon.rb
octobat-2.0.2 lib/octobat/coupon.rb
octobat-2.0.1 lib/octobat/coupon.rb
octobat-2.0.0 lib/octobat/coupon.rb