Sha256: 878c6914ac17e9f959c5c2a54e1146efe4721b4a621ec42bb38e151ff911fd84
Contents?: true
Size: 832 Bytes
Versions: 20
Compression:
Stored size: 832 Bytes
Contents
module Recurly # Redemptions are not top-level resources, but they can be accessed (and # created) through {Coupon} instances. # # @example # coupon = Coupon.find "summer2011" # coupon.redemptions.each { |r| p r } # coupon.redeem Account.find("groupon_lover") class Redemption < Resource # @return [Coupon] belongs_to :coupon # @return [Account] belongs_to :account, :readonly => false define_attribute_methods %w( single_use total_discounted_in_cents currency created_at ) def save return false if persisted? copy_from coupon.redeem account, currency true rescue Recurly::API::UnprocessableEntity => e apply_errors e false end # Redemptions are only writeable through {Coupon} instances. embedded! end end
Version data entries
20 entries across 20 versions & 1 rubygems