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)

Options Hash (options):

  • :options (Hash)

    period attributes

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)

Options Hash (options):

  • :page (Integer) — default: 1

    Page number.

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


Options Hash (options):

  • :page (Integer) — default: 1

    Page number.

  • :merchant (Integer)

    Merchant account



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)

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)

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