Module: Vindi::Rest::Plan

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

Overview

Methods for the Plans API

Instance Method Summary collapse

Instance Method Details

#create_plan(options = {}) ⇒ Hash

Create a plan for a merchant vindi

Examples:

Create a plan for a merchant vindi

client.create_plan(name: 'My Plan', interval: 12)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    Plan attributes

Returns:

  • (Hash)

    The plan created

See Also:



35
36
37
# File 'lib/vindi/rest/plan.rb', line 35

def create_plan(options = {})
  post('plans', options)[:plan]
end

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

List plans for the authenticate user

Examples:

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



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

def list_plans(options = {})
  get('plans', options)[:plans]
end

#plan(plan_id, options = {}) ⇒ Hash

Get a single plan from a merchant

Examples:

Get plan #2 from vindi

client.plan(2)

Parameters:

  • plan_id (Integer)

    ID of the plan

Returns:

  • (Hash)

    The plan you requested, if it exists

See Also:



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

def plan(plan_id, options = {})
  get("plans/#{plan_id}", options)[:plan]
end

#update_plan(plan_id, options = {}) ⇒ Object

Edit a plan

Examples:

Update plan #2

client.update_plan(2, name: 'My Plan', interval: 3)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    Plan attributes

See Also:



46
47
48
# File 'lib/vindi/rest/plan.rb', line 46

def update_plan(plan_id, options = {})
  put("plans/#{plan_id}", options)[:plan]
end