Class: Stripe::Charge

Inherits:
APIResource show all
Includes:
APIOperations::Create, APIOperations::List, APIOperations::Update
Defined in:
lib/stripe/charge.rb

Instance Attribute Summary

Attributes inherited from StripeObject

#api_key

Instance Method Summary collapse

Methods included from APIOperations::Update

#save

Methods included from APIOperations::Create

included

Methods included from APIOperations::List

included

Methods inherited from APIResource

class_name, #refresh, retrieve, url, #url

Methods inherited from StripeObject

#[], #[]=, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Method Details

#capture(params = {}) ⇒ Object



13
14
15
16
17
# File 'lib/stripe/charge.rb', line 13

def capture(params={})
  response, api_key = Stripe.request(:post, capture_url, @api_key, params)
  refresh_from(response, api_key)
  self
end

#refund(params = {}) ⇒ Object



7
8
9
10
11
# File 'lib/stripe/charge.rb', line 7

def refund(params={})
  response, api_key = Stripe.request(:post, refund_url, @api_key, params)
  refresh_from(response, api_key)
  self
end

#update_dispute(params) ⇒ Object



19
20
21
22
23
# File 'lib/stripe/charge.rb', line 19

def update_dispute(params)
  response, api_key = Stripe.request(:post, dispute_url, @api_key, params)
  refresh_from({ :dispute => response }, api_key, true)
  dispute
end