Module: Virtuous::Client::RecurringGift

Included in:
Virtuous::Client
Defined in:
lib/virtuous/client/recurring_gift.rb

Overview

Recurring Gift data

{
  contactId: [Integer],
  startDate: [Time],
  frequency: [String],
  amount: [Float],
  nextExpectedPaymentDate: [Time],
  anticipatedEndDate: [Time],
  thankYouDate: [Time],
  segmentId: [Integer],
  automatedPayments: [Boolean],
  trackPayments: [Boolean],
  isPrivate: [Boolean],
  designations: [
    {
      projectId: [Integer],
      amountDesignated: [Float]
    }
  ],
  customFields: [
    {
      name: [String],
      value: [String],
      displayName: [String]
    }
  ]
}

Instance Method Summary collapse

Instance Method Details

#create_recurring_gift(data) ⇒ Hash

Creates a recurring gift.

Examples:

client.create_recurring_gift(
  contact_id: 1, start_date: Date.today, frequency: 'Monthly', amount: 1000
)

Parameters:

  • data (Hash)

    A hash containing the recurring gift details. Refer to the Recurring Gift data section above to see the available attributes.

Returns:

  • (Hash)

    The recurring gift that has been created.



60
61
62
# File 'lib/virtuous/client/recurring_gift.rb', line 60

def create_recurring_gift(data)
  parse(post('api/RecurringGift', format(data)))
end

#get_recurring_gift(id) ⇒ Hash

Fetches a recurring gift record by id.

Examples:

client.get_recurring_gift(1)

Parameters:

  • id (Integer)

    The id of the recurring gift.

Returns:

  • (Hash)

    The recurring gift information in a hash.



43
44
45
# File 'lib/virtuous/client/recurring_gift.rb', line 43

def get_recurring_gift(id)
  parse(get("api/RecurringGift/#{id}"))
end

#update_recurring_gift(id, data) ⇒ Hash

Note:

Excluding a property will remove it's value from the object.

Updates a recurring gift.

If you're only updating a single property, the entire model is still required.

Examples:

client.update_recurring_gift(
  1, start_date: Date.today, frequency: 'Daily', amount: 500
)

Parameters:

  • id (Integer)

    The id of the recurring gift to update.

  • data (Hash)

    A hash containing the recurring gift details. Refer to the Gift data section above to see the available attributes.

Returns:

  • (Hash)

    The recurring gift that has been updated.



81
82
83
# File 'lib/virtuous/client/recurring_gift.rb', line 81

def update_recurring_gift(id, data)
  parse(put("api/RecurringGift/#{id}", format(data)))
end