Sha256: 04a0e7b6eba1c00111321d945f06e35ccd0e954ae2a9c52e65efc1b8527c457d

Contents?: true

Size: 877 Bytes

Versions: 5

Compression:

Stored size: 877 Bytes

Contents

module Pingpp
  class CouponTemplate < AppBasedResource
    extend Pingpp::APIOperations::Create
    extend Pingpp::APIOperations::List
    include Pingpp::APIOperations::Delete
    include Pingpp::APIOperations::Update

    def self.object_name
      'coupon_template'
    end

    def self.list_coupons(coupon_template, filters={}, opts={})
      opts = Util.normalize_opts(opts)
      response, opts = request(:get, coupon_url(coupon_template, opts), filters, opts)
      ListObject.construct_from(response, opts)
    end

    def self.create_coupons(coupon_template, params={}, opts={})
      response, opts = request(:post, coupon_url(coupon_template, opts), params, opts)
      Util.convert_to_pingpp_object(response, opts)
    end

    private

    def self.coupon_url(coupon_template, opts={})
      resource_url(opts) + "/#{coupon_template}/coupons"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pingpp-2.2.4 lib/pingpp/coupon_template.rb
pingpp-2.2.3 lib/pingpp/coupon_template.rb
pingpp-2.2.2 lib/pingpp/coupon_template.rb
pingpp-2.2.1 lib/pingpp/coupon_template.rb
pingpp-2.2.0 lib/pingpp/coupon_template.rb