Class: Invoiced::PaymentPlan

Inherits:
Object
  • Object
show all
Includes:
Operations::Delete
Defined in:
lib/invoiced/payment_plan.rb

Constant Summary collapse

OBJECT_NAME =
'payment_plan'

Instance Attribute Summary

Attributes inherited from Object

#client

Instance Method Summary collapse

Methods included from Operations::Delete

#delete

Methods inherited from Object

#[], #[]=, #add_accessors, #build_endpoint, #each, #endpoint, #endpoint_base, #inspect, #keys, #metaclass, #method_missing, #refresh_from, #remove_accessors, #set_endpoint_base, #to_hash, #to_json, #to_s, #values

Constructor Details

#initialize(client, id = nil, values = {}) ⇒ PaymentPlan

Returns a new instance of PaymentPlan.



7
8
9
10
# File 'lib/invoiced/payment_plan.rb', line 7

def initialize(client, id=nil, values={})
	super
	@endpoint = '/payment_plan'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Invoiced::Object

Instance Method Details

#cancelObject



24
25
26
# File 'lib/invoiced/payment_plan.rb', line 24

def cancel
    delete
end

#create(params = {}, opts = {}) ⇒ Object



12
13
14
15
16
# File 'lib/invoiced/payment_plan.rb', line 12

def create(params={}, opts={})
    response = @client.request(:put, self.endpoint(), params, opts)

    Util.convert_to_object(self, response[:body])
end

#retrieve(params = {}) ⇒ Object



18
19
20
21
22
# File 'lib/invoiced/payment_plan.rb', line 18

def retrieve(params={})
    response = @client.request(:get, self.endpoint(), params)

    Util.convert_to_object(self, response[:body])
end