Class: LucidShopify::ActivateCharge

Inherits:
Object
  • Object
show all
Defined in:
lib/lucid_shopify/activate_charge.rb

Instance Method Summary collapse

Constructor Details

#initialize(client: Container[:client]) ⇒ ActivateCharge

Returns a new instance of ActivateCharge.

Parameters:

  • client (#post_json) (defaults to: Container[:client])


10
11
12
# File 'lib/lucid_shopify/activate_charge.rb', line 10

def initialize(client: Container[:client])
  @client = client
end

Instance Method Details

#call(credentials, charge) ⇒ Hash

Activate a recurring application charge.

Parameters:

  • credentials (Credentials)
  • charge (#to_h)

    an accepted charge received from Shopify via callback

Returns:

  • (Hash)

    the active charge



22
23
24
25
26
# File 'lib/lucid_shopify/activate_charge.rb', line 22

def call(credentials, charge)
  data = @client.post_json(credentials, "recurring_application_charges/#{charge.to_h['id']}/activate", charge.to_h)

  data['recurring_application_charge']
end