Class: Stripe2QB::StripeApi
- Inherits:
-
Object
- Object
- Stripe2QB::StripeApi
- Includes:
- OptionsReading
- Defined in:
- lib/stripe2qb/stripe_api.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #get_transfer_charges(transfer_id) ⇒ Object
- #get_transfer_refunds(transfer_id) ⇒ Object
- #get_transfers(start_date, end_date = nil) ⇒ Object
-
#initialize(options) ⇒ StripeApi
constructor
A new instance of StripeApi.
Methods included from OptionsReading
#get_required_from_options, #set_attribute_from_options
Constructor Details
#initialize(options) ⇒ StripeApi
Returns a new instance of StripeApi.
9 10 11 |
# File 'lib/stripe2qb/stripe_api.rb', line 9 def initialize() Stripe.api_key = ('api_key', ) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/stripe2qb/stripe_api.rb', line 7 def api_key @api_key end |
Instance Method Details
#get_transfer_charges(transfer_id) ⇒ Object
17 18 19 |
# File 'lib/stripe2qb/stripe_api.rb', line 17 def get_transfer_charges(transfer_id) Stripe::BalanceTransaction.all(transfer: transfer_id, type: 'charge', limit: 100) end |
#get_transfer_refunds(transfer_id) ⇒ Object
21 22 23 |
# File 'lib/stripe2qb/stripe_api.rb', line 21 def get_transfer_refunds(transfer_id) Stripe::BalanceTransaction.all(transfer: transfer_id, type: 'refund', limit: 100) end |
#get_transfers(start_date, end_date = nil) ⇒ Object
13 14 15 |
# File 'lib/stripe2qb/stripe_api.rb', line 13 def get_transfers(start_date, end_date = nil) Stripe::Transfer.list(date: date_range_criteria(start_date, end_date), status: 'paid', limit: 100) end |