Module: Chargify

Defined in:
lib/chargify_api_ares/config.rb,
lib/chargify_api_ares/resources/base.rb,
lib/chargify_api_ares/resources/site.rb,
lib/chargify_api_ares/resources/event.rb,
lib/chargify_api_ares/resources/usage.rb,
lib/chargify_api_ares/response_helper.rb,
lib/chargify_api_ares/resources/charge.rb,
lib/chargify_api_ares/resources/coupon.rb,
lib/chargify_api_ares/resources/invoice.rb,
lib/chargify_api_ares/resources/payment.rb,
lib/chargify_api_ares/resources/product.rb,
lib/chargify_api_ares/resources/webhook.rb,
lib/chargify_api_ares/behaviors/metadata.rb,
lib/chargify_api_ares/resources/customer.rb,
lib/chargify_api_ares/behaviors/metafield.rb,
lib/chargify_api_ares/resources/component.rb,
lib/chargify_api_ares/resources/migration.rb,
lib/chargify_api_ares/resources/statement.rb,
lib/chargify_api_ares/resources/allocation.rb,
lib/chargify_api_ares/behaviors/inspectable.rb,
lib/chargify_api_ares/resources/reason_code.rb,
lib/chargify_api_ares/resources/transaction.rb,
lib/chargify_api_ares/resources/subscription.rb,
lib/chargify_api_ares/resources/product_family.rb,
lib/chargify_api_ares/resources/management_link.rb,
lib/chargify_api_ares/resources/payment_profile.rb,
lib/chargify_api_ares/resources/renewal_preview.rb,
lib/chargify_api_ares/resources/customer_metadata.rb,
lib/chargify_api_ares/resources/customer_metafield.rb,
lib/chargify_api_ares/resources/subscription_metadata.rb,
lib/chargify_api_ares/resources/subscription_metafield.rb

Defined Under Namespace

Modules: Behaviors, Renewal, ResponseHelper Classes: Allocation, Base, Charge, Component, Coupon, Customer, CustomerMetadata, CustomerMetafield, Event, Invoice, ManagementLink, Migration, Payment, PaymentProfile, Product, ProductFamily, ReasonCode, Site, Statement, Subscription, SubscriptionMetadata, SubscriptionMetafield, Transaction, Usage, Webhook

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/chargify_api_ares/config.rb', line 3

def api_key
  @api_key
end

.domainObject

Returns the value of attribute domain.



3
4
5
# File 'lib/chargify_api_ares/config.rb', line 3

def domain
  @domain
end

.formatObject

Returns the value of attribute format.



3
4
5
# File 'lib/chargify_api_ares/config.rb', line 3

def format
  @format
end

.protocolObject

Returns the value of attribute protocol.



3
4
5
# File 'lib/chargify_api_ares/config.rb', line 3

def protocol
  @protocol
end

.siteObject

Returns the value of attribute site.



3
4
5
# File 'lib/chargify_api_ares/config.rb', line 3

def site
  @site
end

.subdomainObject

Returns the value of attribute subdomain.



3
4
5
# File 'lib/chargify_api_ares/config.rb', line 3

def subdomain
  @subdomain
end

.timeoutObject

Returns the value of attribute timeout.



3
4
5
# File 'lib/chargify_api_ares/config.rb', line 3

def timeout
  @timeout
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Chargify)

    the object that the method was called on



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/chargify_api_ares/config.rb', line 5

def configure
  # Since site is dependent on other fields, we erase it before yielding so that it is recalculated based
  # on changes from any of the other settings
  self.site = nil

  yield self

  self.protocol  = protocol  || "https"
  self.domain    = domain    || "chargify.com"
  self.format    = format    || :xml
  self.subdomain = subdomain || "test"
  self.site      = site || "#{protocol}://#{subdomain}.#{domain}"

  Base.site      = site
  Base.user      = api_key
  Base.password  = 'X'
  Base.timeout   = timeout unless (timeout.blank?)
  Base.format    = format
end