Module: Vindi::Rest::Notification

Included in:
Vindi::Rest
Defined in:
lib/vindi/rest/notification.rb

Overview

Methods for the notifications API

Instance Method Summary collapse

Instance Method Details

#create_notification(options = {}) ⇒ Hash

Create a notification for a merchant vindi

Examples:

Create a notification for a merchant vindi

client.create_notification(status: "active", notification_type: "email",
                           name: "Hoops", subject: "Hoops",
                           content: "Hey, Hoops!",
                           trigger_type: "charge_created_at",
                           trigger_day: 5, bcc: "")

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    notification attributes

Returns:

  • (Hash)

    The notification created

See Also:



37
38
39
# File 'lib/vindi/rest/notification.rb', line 37

def create_notification(options = {})
  post('notifications', options)[:notification]
end

#create_notification_item(notification_id, options = {}) ⇒ Object

Creates notification items for a merchant

Examples:

create notification item #2

client.create_notification_item(2, item_type: "Plan", item_id: 22)

See Also:



69
70
71
72
# File 'lib/vindi/rest/notification.rb', line 69

def create_notification_item(notification_id, options = {})
  url = "notifications/%{id}/notification_items" % { id: notification_id }
  post(url, options)[:notification_item]
end

#delete_notification(notification_id, options = {}) ⇒ Object

Delete a notification from merchant vindi

Examples:

Delete notification #2

client.delete_notification(2)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    notification attributes

See Also:



82
83
84
# File 'lib/vindi/rest/notification.rb', line 82

def delete_notification(notification_id, options = {})
  delete("notifications/#{notification_id}", options)[:notification]
end

#delete_notification_item(notification_id, notification_item_id, options = {}) ⇒ Object

Delete a notification item from merchant vindi

Examples:

Delete notification item #3

client.delete_notification_item(2, 3)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    notification attributes

See Also:



95
96
97
98
99
100
# File 'lib/vindi/rest/notification.rb', line 95

def delete_notification_item(notification_id, notification_item_id, options = {})
  url = "notifications/%{id}/notification_items/%{notification_item_id}" % {
    id: notification_id, notification_item_id: notification_item_id
  }
  delete(url, options)[:notification_item]
end

#list_notification_items(notification_id, options = {}) ⇒ Object

List notification items for a merchant

Examples:

notification_items #2

client.list_notification_items(2)

See Also:



58
59
60
61
# File 'lib/vindi/rest/notification.rb', line 58

def list_notification_items(notification_id, options = {})
  url = "notifications/%{id}/notification_items" % { id: notification_id }
  get(url, options)[:notification_items]
end

#list_notifications(options = {}) ⇒ Array<Hash>

List notifications for the authenticate user

Examples:

Get all notifications from merchant vindi

Returns:

  • (Array<Hash>)

    A list of notifications for a merchant.



11
12
13
# File 'lib/vindi/rest/notification.rb', line 11

def list_notifications(options = {})
  get('notifications', options)[:notifications]
end

#notification(notification_id, options = {}) ⇒ Hash

Get a single notification from a merchant

Examples:

Get notification #2 from vindi

client.notification(2)

Parameters:

  • notification_id (Integer)

    ID of the notification

Returns:

  • (Hash)

    The notification you requested, if it exists

See Also:



22
23
24
# File 'lib/vindi/rest/notification.rb', line 22

def notification(notification_id, options = {})
  get("notifications/#{notification_id}", options)[:notification]
end

#update_notification(notification_id, options = {}) ⇒ Object

Edit a notification

Examples:

update notification #2

client.update_notification(2, trigger_day: 3)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    notification attributes

See Also:



48
49
50
# File 'lib/vindi/rest/notification.rb', line 48

def update_notification(notification_id, options = {})
  put("notifications/#{notification_id}", options)[:notification]
end