Sha256: 8318282311472e91cb7c8842872d3107dddd63c3a8324403ffcdee153e4f1e40

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

module ShelbyArena

  class Contribution < ApiObject
    attribute :contribution_id, Integer
    attribute :transaction_number, Integer
    attribute :currency_amount, Float
    attribute :contribution_date, Date
    attribute :contribution_funds, Hash
    attribute :currency_type_id, Integer
    attribute :currency_type_value, String
    attribute :person_id, Integer
    attribute :person_information, Hash
    attribute :person_link, String
    attribute :batch_id, Integer
    attribute :batch_link, String
    attribute :refund_contribution_id, Integer


    # Load the contribution by the specified ID.
    #
    # @param contribution_id The ID of the contribution to load.
    #
    # Returns a new Contribution object.
    def self.load_by_id(contribution_id)
      reader = ContributionReader.new(contribution_id)
      self.new(reader)
    end

    # Constructor.
    #
    # @param reader (optional) The object that has the data. This can be a ContributionReader or Hash object.
    def initialize(reader = nil)    
      if reader.is_a?(ContributionReader)    
        initialize_from_json_object(reader.load_data['Contribution'])
      elsif reader.is_a?(Hash)   
        initialize_from_json_object(reader)
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shelby-arena-api-0.1.0 lib/api/contribution.rb