Module: Vindi::Rest::Period

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

Overview

Methods for the periods API

Instance Method Summary collapse

Instance Method Details

#create_period_bill(period_id, options = {}) ⇒ Hash

Create a period for a merchant vindi

Examples:

Create a period for a merchant vindi

client.create_period_bill(360)

Parameters:

  • bill_id (Integer)

    ID of the period to generate a bill

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    period attributes

Returns:

  • (Hash)

    The period created

See Also:



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

def create_period_bill(period_id, options = {})
  post("periods/#{period_id}/bill", options)
end

#list_period_usages(period_id, options = {}) ⇒ Array<Hash>

List period usages

Examples:

List period usages

client.list_period_usages(2)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :page (Integer) — default: 1

    Page number.

Returns:

  • (Array<Hash>)

    A list of usages for a period.

See Also:



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

def list_period_usages(period_id, options = {})
  get("periods/#{period_id}/usages", options)[:usages]
end

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

List periods for the authenticate user

Examples:

Get all periods 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 periods for a merchant.



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

def list_periods(options = {})
  get('periods', options)[:periods]
end

#period(period_id, options = {}) ⇒ Hash

Get a single period from a merchant

Examples:

Get period #2 from vindi

client.period(2)

Parameters:

  • period_id (Integer)

    ID of the period

Returns:

  • (Hash)

    The period you requested, if it exists

See Also:



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

def period(period_id, options = {})
  get("periods/#{period_id}", options)[:period]
end

#update_period(period_id, options = {}) ⇒ Object

Edit a period

Examples:

Update period #2

client.update_period(2, name: 'My period', interval: 3)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    period attributes

See Also:



47
48
49
# File 'lib/vindi/rest/period.rb', line 47

def update_period(period_id, options = {})
  put("periods/#{period_id}", options)[:period]
end