Class: Stripe::Customer
Constant Summary
collapse
- OBJECT_NAME =
"customer".freeze
Instance Attribute Summary
Attributes inherited from APIResource
#save_with_parent
Instance Method Summary
collapse
create
list
nested_resource_class_methods
included, #save
#delete, included
Methods inherited from APIResource
class_name, custom_method, #refresh, resource_url, #resource_url, retrieve, save_nested_resource
included
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #refresh_from, serialize_params, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Stripe::StripeObject
Instance Method Details
#add_invoice_item(params, opts = {}) ⇒ Object
30
31
32
33
|
# File 'lib/stripe/resources/customer.rb', line 30
def add_invoice_item(params, opts = {})
opts = @opts.merge(Util.normalize_opts(opts))
InvoiceItem.create(params.merge(customer: id), opts)
end
|
#cancel_subscription(params = {}, opts = {}) ⇒ Object
60
61
62
63
64
|
# File 'lib/stripe/resources/customer.rb', line 60
def cancel_subscription(params = {}, opts = {})
resp, opts = request(:delete, subscription_url, params, opts)
initialize_from({ subscription: resp.data }, opts, true)
subscription
end
|
#charges(params = {}, opts = {}) ⇒ Object
50
51
52
53
|
# File 'lib/stripe/resources/customer.rb', line 50
def charges(params = {}, opts = {})
opts = @opts.merge(Util.normalize_opts(opts))
Charge.all(params.merge(customer: id), opts)
end
|
#create_subscription(params = {}, opts = {}) ⇒ Object
72
73
74
75
76
|
# File 'lib/stripe/resources/customer.rb', line 72
def create_subscription(params = {}, opts = {})
resp, opts = request(:post, subscriptions_url, params, opts)
initialize_from({ subscription: resp.data }, opts, true)
subscription
end
|
#create_upcoming_invoice(params = {}, opts = {}) ⇒ Object
55
56
57
58
|
# File 'lib/stripe/resources/customer.rb', line 55
def create_upcoming_invoice(params = {}, opts = {})
opts = @opts.merge(Util.normalize_opts(opts))
Invoice.create(params.merge(customer: id), opts)
end
|
#delete_discount ⇒ Object
78
79
80
81
|
# File 'lib/stripe/resources/customer.rb', line 78
def delete_discount
_, opts = request(:delete, discount_url)
initialize_from({ discount: nil }, opts, true)
end
|
#invoice_items(params = {}, opts = {}) ⇒ Object
40
41
42
43
|
# File 'lib/stripe/resources/customer.rb', line 40
def invoice_items(params = {}, opts = {})
opts = @opts.merge(Util.normalize_opts(opts))
InvoiceItem.all(params.merge(customer: id), opts)
end
|
#invoices(params = {}, opts = {}) ⇒ Object
35
36
37
38
|
# File 'lib/stripe/resources/customer.rb', line 35
def invoices(params = {}, opts = {})
opts = @opts.merge(Util.normalize_opts(opts))
Invoice.all(params.merge(customer: id), opts)
end
|
#upcoming_invoice(params = {}, opts = {}) ⇒ Object
45
46
47
48
|
# File 'lib/stripe/resources/customer.rb', line 45
def upcoming_invoice(params = {}, opts = {})
opts = @opts.merge(Util.normalize_opts(opts))
Invoice.upcoming(params.merge(customer: id), opts)
end
|
#update_subscription(params = {}, opts = {}) ⇒ Object
66
67
68
69
70
|
# File 'lib/stripe/resources/customer.rb', line 66
def update_subscription(params = {}, opts = {})
resp, opts = request(:post, subscription_url, params, opts)
initialize_from({ subscription: resp.data }, opts, true)
subscription
end
|