Module: Vindi::Rest::Message

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

Overview

Methods for the messages API

Instance Method Summary collapse

Instance Method Details

#create_message(options = {}) ⇒ Hash

Create a message for a merchant vindi

Examples:

Create a message for a merchant vindi

client.create_message({ "customer_id": 2, "charge_id": 71,
                        "notification_id": 6, "email": "[email protected]" })

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    message attributes

Returns:

  • (Hash)

    The message created

See Also:



36
37
38
# File 'lib/vindi/rest/message.rb', line 36

def create_message(options = {})
  post('messages', options)[:message]
end

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

List messages for the authenticate user

Examples:

Get all messages from merchant vindi

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :page (Integer) — default: 1

    Page number.

  • :merchant (Integer)

    Merchant account

Returns:

  • (Array<Hash>)

    A list of messages for a merchant.



13
14
15
# File 'lib/vindi/rest/message.rb', line 13

def list_messages(options = {})
  get('messages', options)[:messages]
end

#message(message_id, options = {}) ⇒ Hash

Get a single message from a merchant

Examples:

Get message #154 from vindi

client.message(154)

Parameters:

  • message_id (Integer)

    ID of the message

Returns:

  • (Hash)

    The message you requested, if it exists

See Also:



24
25
26
# File 'lib/vindi/rest/message.rb', line 24

def message(message_id, options = {})
  get("messages/#{message_id}", options)[:message]
end