class Stripe2QB::StripeApi
Attributes
api_key[R]
Public Class Methods
new(options)
click to toggle source
# File lib/stripe2qb/stripe_api.rb, line 9 def initialize(options) Stripe.api_key = set_attribute_from_options('api_key', options) end
Public Instance Methods
get_transfer_charges(transfer_id)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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
Private Instance Methods
date_range_criteria(start_date, end_date = nil)
click to toggle source
# File lib/stripe2qb/stripe_api.rb, line 27 def date_range_criteria(start_date, end_date = nil) start_time = to_time(start_date) end_time = to_time(end_date || Date.parse(start_date) + 1.day) { gte: start_time, lt: end_time } end
to_time(date)
click to toggle source
# File lib/stripe2qb/stripe_api.rb, line 34 def to_time(date) date = Date.parse(date) if date.is_a?(String) Time.parse("#{date} 0:00 UTC").to_i end