Sha256: 6e55c241b9c0e8f472e0a27da550750b4eaaed8139b7a90f27b245153e4696cb
Contents?: true
Size: 1.49 KB
Versions: 5
Compression:
Stored size: 1.49 KB
Contents
module RubyPsigate class InvalidRecurringItem < RubyPsigateError; end # This class encapsulates the recurring charge elements for use in the Account Class class RecurringCharge include HashVariables hashable %w( StoreID RBCID RBName Interval RBTrigger ProcessType Status StartTime EndTime ) attr_accessor :storeid, :rbcid, :rbname, :interval, :rbtrigger, :status, :starttime, :endtime, :processtype def initialize(attributes = {}) @storeid = attributes[:storeid] @rbcid = attributes[:rbcid] @rbname = attributes[:rbname] @interval = attributes[:interval] @rbtrigger = attributes[:rbtrigger] @status = attributes[:status] @starttime = attributes[:starttime] @endtime = attributes[:endtime] @processtype = attributes[:processtype] @items = [] end def to_hash @return_hash = super unless items.count == 0 @return_hash[:ItemInfo] = [] items.each do |item| @return_hash[:ItemInfo] << item.to_hash end end @return_hash = @return_hash.delete_if { |key, value| value.nil? } # Delete empty hash values @return_hash end def << (item) raise InvalidRecurringItem unless item.is_a?(RecurringItem) @items << item return self end def items holder = [] @items.each do |item| holder << item.to_hash end holder end end end
Version data entries
5 entries across 5 versions & 1 rubygems