Class: TheCity::DonationExport

Inherits:
ApiObject show all
Defined in:
lib/api/donation_export.rb

Instance Attribute Summary

Attributes inherited from ApiObject

#error_messages, #marked_for_destruction

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiObject

__tc_attributes, #delete, #initialize_from_json_object, #is_deleted?, #save, #set_attributes, tc_attr_accessor, #to_attributes

Constructor Details

#initialize(json_data = nil) ⇒ DonationExport

Constructor.

Parameters:

  • json_data (optional) (defaults to: nil)

    JSON data of the donation export.



29
30
31
32
# File 'lib/api/donation_export.rb', line 29

def initialize(json_data = nil)
  @writer_object = DonationExportWriter
  initialize_from_json_object(json_data) unless json_data.nil?
end

Class Method Details

.load_by_id(donation_export_id, options = {}) ⇒ Object

Loads the donation export by the specified ID.

Returns a new TheCity::DonationExport object.

Parameters:

  • donation_export_id

    The ID of the donation export to load.

  • options (defaults to: {})

    A hash of options for requesting data from the server.

    donation_id is required



18
19
20
21
22
23
# File 'lib/api/donation_export.rb', line 18

def self.load_by_id(donation_export_id, options = {})
  donation_reader = DonationExportReader.new(donation_export_id, options)
  self.new(donation_reader.load_feed)
rescue
  nil        
end