class LucidShopify::CreateCharge
Public Class Methods
new(client: Container[:client])
click to toggle source
@param client [#post_json]
# File lib/lucid_shopify/create_charge.rb, line 10 def initialize(client: Container[:client]) @client = client end
Public Instance Methods
call(credentials, charge)
click to toggle source
Create a new recurring application charge.
@param credentials [Credentials] @param charge [Hash]
@return [Hash] the pending charge
# File lib/lucid_shopify/create_charge.rb, line 22 def call(credentials, charge) data = @client.post_json(credentials, 'recurring_application_charges', post_data(charge)) data['recurring_application_charge'] end
Private Instance Methods
post_data(charge)
click to toggle source
@param charge [Hash]
@return [Hash]
# File lib/lucid_shopify/create_charge.rb, line 33 def post_data(charge) { 'recurring_application_charge' => { 'return_url' => LucidShopify.config.billing_callback_uri }.merge(charge.transform_keys(&:to_s)), } end