Class: LedgerSync::Adaptors::Stripe::Adaptor
- Defined in:
- lib/ledger_sync/adaptors/stripe/adaptor.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_key:) ⇒ Adaptor
constructor
A new instance of Adaptor.
- #url_for(resource:) ⇒ Object
- #wrap_perform ⇒ Object
Methods inherited from Adaptor
#adaptor_configuration, #base_module, base_module, base_operation_module_for, config, #ledger_attributes_to_save, #parse_operation_error, #searcher_for?, #searcher_klass_for, url_for
Methods included from Validatable
#valid?, #validate, #validate_or_fail
Constructor Details
#initialize(api_key:) ⇒ Adaptor
Returns a new instance of Adaptor.
11 12 13 14 15 |
# File 'lib/ledger_sync/adaptors/stripe/adaptor.rb', line 11 def initialize( api_key: ) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/ledger_sync/adaptors/stripe/adaptor.rb', line 9 def api_key @api_key end |
Class Method Details
.ledger_attributes_to_save ⇒ Object
39 40 41 |
# File 'lib/ledger_sync/adaptors/stripe/adaptor.rb', line 39 def self.ledger_attributes_to_save [] end |
Instance Method Details
#url_for(resource:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ledger_sync/adaptors/stripe/adaptor.rb', line 17 def url_for(resource:) base_url = 'https://dashboard.stripe.com' resource_path = case resource when LedgerSync::Customer "/customers/#{resource.ledger_id}" else raise Error::AdaptorError::UnknownURLFormat.new( adaptor: self, resource: resource ) end base_url + resource_path end |
#wrap_perform ⇒ Object
32 33 34 35 36 37 |
# File 'lib/ledger_sync/adaptors/stripe/adaptor.rb', line 32 def wrap_perform ::Stripe.api_key = api_key yield ensure ::Stripe.api_key = nil end |