Class: VaucharAPI::VoucherRedemption

Inherits:
Base
  • Object
show all
Defined in:
lib/vauchar_api/resources/voucher_redemption.rb

Overview

redemption = VaucharAPI::VoucherRedemption.find(“vcr-15533454515c962bab95e5b”) redemption

Class Method Summary collapse

Methods inherited from Base

#accepts_attributes, #encode, init_prefix, init_prefix_explicit, password, user

Class Method Details

.destroy(params) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/vauchar_api/resources/voucher_redemption.rb', line 12

def self.destroy(params)
  begin
    redemption = VaucharAPI::VoucherRedemption.find({ voucher_id: params[:voucher_id] })
    resource = delete("#{params[:voucher_id]}/redemptions/#{redemption[:id]}")
  rescue
    p "destroy fail!!"
  end
end

.find(params) ⇒ Object



7
8
9
10
# File 'lib/vauchar_api/resources/voucher_redemption.rb', line 7

def self.find(params)
  resource = get("#{params[:voucher_id]}/redemptions", {})
  resource.first.with_indifferent_access
end