Class: YourMembership::Sa::Export

Inherits:
Base
  • Object
show all
Defined in:
lib/your_membership/sa_export.rb

Overview

The Export object provides a convenient abstraction that encapsulates the export process

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

build_XML_request, new_call_id, post, response_to_array, response_to_array_of_hashes, response_valid?, response_ym_error?

Constructor Details

#initialize(export_id) ⇒ Export

Note:

There is not yet a compelling reason to call Export.new() directly, however it can be done.

Export Initializer - Use any of the public class methods to create objects of this type.

Parameters:

  • export_id (String)

    The ID of the export job for which to create the object.



16
17
18
19
20
# File 'lib/your_membership/sa_export.rb', line 16

def initialize(export_id)
  @export_id = export_id
  @status = nil
  @export_uri = nil
end

Instance Attribute Details

#export_idString (readonly)

The unique ID assigned by the API when an export is initiated

Returns:

  • (String)

    the current value of export_id



8
9
10
# File 'lib/your_membership/sa_export.rb', line 8

def export_id
  @export_id
end

#export_uriString (readonly)

The uri from which to download the requested report once the status is :complete

Returns:

  • (String)

    the current value of export_uri



8
9
10
# File 'lib/your_membership/sa_export.rb', line 8

def export_uri
  @export_uri
end

#statusSymbol (readonly)

Instance implementation of the Sa::Export.status method that also sets the export_uri if the status is :complete

Returns:

  • (Symbol)

    Returns the symbol for the current status state.



8
9
10
# File 'lib/your_membership/sa_export.rb', line 8

def status
  @status
end

Class Method Details

.all_invoiceItems(date, unicode) ⇒ YourMembership::Sa::Export

Starts an export of all invoice items.

Parameters:

  • date (DateTime)

    Date to export records from.

  • unicode (Boolean)

    Export format.

Returns:

See Also:



58
59
60
# File 'lib/your_membership/sa_export.rb', line 58

def self.all_invoiceItems(date, unicode) # rubocop:disable Style/MethodName
  generic_export('Sa.Export.All.InvoiceItems', date, unicode)
end

.career_openings(date, unicode) ⇒ YourMembership::Sa::Export

Starts an export of career openings.

Parameters:

  • date (DateTime)

    Date to export records from.

  • unicode (Boolean)

    Export format.

Returns:

See Also:



69
70
71
# File 'lib/your_membership/sa_export.rb', line 69

def self.career_openings(date, unicode)
  generic_export('Sa.Export.Career.Openings', date, unicode)
end

.donations_invoiceItems(date, unicode) ⇒ YourMembership::Sa::Export

Starts an export of donation invoice items.

Parameters:

  • date (DateTime)

    Date to export records from.

  • unicode (Boolean)

    Export format.

Returns:

See Also:



91
92
93
# File 'lib/your_membership/sa_export.rb', line 91

def self.donations_invoiceItems(date, unicode) # rubocop:disable Style/MethodName
  generic_export('Sa.Export.Donations.InvoiceItems', date, unicode)
end

.donations_transactions(date, unicode) ⇒ YourMembership::Sa::Export

Starts an export of donation transactions.

Parameters:

  • date (DateTime)

    Date to export records from.

  • unicode (Boolean)

    Export format.

Returns:

See Also:



80
81
82
# File 'lib/your_membership/sa_export.rb', line 80

def self.donations_transactions(date, unicode)
  generic_export('Sa.Export.Donations.Transactions', date, unicode)
end

.dues_invoiceItems(date, unicode) ⇒ YourMembership::Sa::Export

Starts an export of dues invoice items.

Parameters:

  • date (DateTime)

    Date to export records from.

  • unicode (Boolean)

    Export format.

Returns:

See Also:



113
114
115
# File 'lib/your_membership/sa_export.rb', line 113

def self.dues_invoiceItems(date, unicode)  # rubocop:disable Style/MethodName
  generic_export('Sa.Export.Dues.InvoiceItems', date, unicode)
end

.dues_transactions(date, unicode) ⇒ YourMembership::Sa::Export

Starts an export of dues transactions.

Parameters:

  • date (DateTime)

    Date to export records from.

  • unicode (Boolean)

    Export format.

Returns:

See Also:



102
103
104
# File 'lib/your_membership/sa_export.rb', line 102

def self.dues_transactions(date, unicode)
  generic_export('Sa.Export.Dues.Transactions', date, unicode)
end

.event_registrations(event_id, unicode, options = {}) ⇒ YourMembership::Sa::Export

Starts an export of registration records for an event

Parameters:

  • event_id (Integer)

    Event ID of the event to view registrations.

  • unicode (Boolean)

    Export format.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :SessionIDs (String)

    Comma Delimited List of Session IDs to filter the results. ex: “1234,9876”

  • :ProductID (Integer)

    Filter the results to only those that have purchased supplied Product ID.

  • :Processed (Integer)

    Filter the results by their Process Status. Options: 0 = All, 1 = Open Records, 2 = Processed Records

  • :LastName (String)

    Filter registrations by the supplied Last Name.

  • :AttendedEvent (Boolean)

    Filter registrations check in status.

Returns:

See Also:



153
154
155
156
# File 'lib/your_membership/sa_export.rb', line 153

def self.event_registrations(event_id, unicode, options = {})  # rubocop:disable Style/MethodName
  options[:EventID] = event_id
  generic_export('Sa.Export.Event.Registrations', nil, unicode, options)
end

.status(export_id) ⇒ Hash

Returns the status of an export by ExportID. This method should be called until a status of either FAILURE or COMPLETE is returned.

Parameters:

  • export_id (String)

    ID of the Export on which to check status.

Returns:

  • (Hash)

    Returns a hash with the status code for the current export as well as the URI of the exported data if available

See Also:



41
42
43
44
45
46
47
48
49
# File 'lib/your_membership/sa_export.rb', line 41

def self.status(export_id)
  options = {}
  options[:ExportID] = export_id

  response = post('/', :body => build_XML_request('Sa.Export.Status', nil, options))

  response_valid? response
  response['YourMembership_Response']['Sa.Export.Status']
end

.store_invoiceItems(date, unicode) ⇒ YourMembership::Sa::Export

Starts an export of store order invoice items.

Parameters:

  • date (DateTime)

    Date to export records from.

  • unicode (Boolean)

    Export format.

Returns:

See Also:



135
136
137
# File 'lib/your_membership/sa_export.rb', line 135

def self.store_invoiceItems(date, unicode) # rubocop:disable Style/MethodName
  generic_export('Sa.Export.Store.InvoiceItems', date, unicode)
end

.store_orders(date, unicode) ⇒ YourMembership::Sa::Export

Starts an export of store orders.

Parameters:

  • date (DateTime)

    Date to export records from.

  • unicode (Boolean)

    Export format.

Returns:

See Also:



124
125
126
# File 'lib/your_membership/sa_export.rb', line 124

def self.store_orders(date, unicode)
  generic_export('Sa.Export.Store.Orders', date, unicode)
end