Class: LedgerSync::Ledgers::Stripe::Client

Inherits:
Client
  • Object
show all
Defined in:
lib/ledger_sync/ledgers/stripe/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Client

base_module, #base_module, base_operation_module_for, config, #ledger_attributes_to_save, #ledger_configuration, ledger_resource_type_for, ledger_resource_type_overrides, operation_class_for, #operation_for, #parse_operation_error, resource_from_ledger_type, resources, root_key, #searcher_class_for, #searcher_for, url_for

Methods included from Util::Mixins::ResourceRegisterableMixin

included

Methods included from Validatable

#valid?, #validate, #validate_or_fail

Constructor Details

#initialize(api_key:) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
# File 'lib/ledger_sync/ledgers/stripe/client.rb', line 11

def initialize(
  api_key:
)
  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



9
10
11
# File 'lib/ledger_sync/ledgers/stripe/client.rb', line 9

def api_key
  @api_key
end

Class Method Details

.ledger_attributes_to_saveObject



31
32
33
# File 'lib/ledger_sync/ledgers/stripe/client.rb', line 31

def self.ledger_attributes_to_save
  []
end

Instance Method Details

#url_for(resource:) ⇒ Object



17
18
19
20
21
22
# File 'lib/ledger_sync/ledgers/stripe/client.rb', line 17

def url_for(resource:)
  DashboardURLHelper.new(
    resource: resource,
    base_url: "https://dashboard.stripe.com"
  ).url
end

#wrap_performObject



24
25
26
27
28
29
# File 'lib/ledger_sync/ledgers/stripe/client.rb', line 24

def wrap_perform
  ::Stripe.api_key = api_key
  yield
ensure
  ::Stripe.api_key = nil
end