class IronBank::Configuration

The Zuora configuration class.

Attributes

auth_type[RW]

Auth type (cookie|token)

cache[RW]

Cache store instance, optionally used by certain resources.

client_id[RW]

OAuth client ID associated with our platform admin user.

client_secret[RW]

OAuth client secret.

domain[RW]

The Zuora domain for our tenant (apisandbox, production, etc.).

excluded_fields_file[RW]

File path for excluded fields (when querying using ZOQL)

export_directory[R]

Directory where the local records are exported.

logger[RW]
middlewares[RW]

middlewares

schema_directory[R]

Directory where the XML describe files are located.

users_file[RW]

File path for Zuora users export

Public Class Methods

new() click to toggle source
# File lib/iron_bank/configuration.rb, line 40
def initialize
  @schema_directory = "./config/schema"
  @export_directory = "./config/export"
  @logger           = IronBank::Logger.new
  @auth_type        = "token"
  @middlewares      = []
end

Public Instance Methods

credentials() click to toggle source
# File lib/iron_bank/configuration.rb, line 71
def credentials
  {
    domain:        domain,
    client_id:     client_id,
    client_secret: client_secret,
    auth_type:     auth_type
  }
end
credentials?() click to toggle source
# File lib/iron_bank/configuration.rb, line 80
def credentials?
  credentials.values.all?
end
excluded_fields() click to toggle source
# File lib/iron_bank/configuration.rb, line 88
def excluded_fields
  return {} unless excluded_fields_file

  unless File.exist?(excluded_fields_file)
    IronBank.logger.warn "File does not exist: #{excluded_fields_file}"

    return {}
  end

  @excluded_fields ||= begin
    Psych.load_file(excluded_fields_file).tap do |fields|
      raise "Excluded fields must be a hash" unless fields.is_a?(Hash)
    end
  end
end
export_directory=(value) click to toggle source
# File lib/iron_bank/configuration.rb, line 62
def export_directory=(value)
  @export_directory = value
  return unless defined? IronBank::Product

  IronBank::LocalRecords::RESOURCE_QUERY_FIELDS.each_key do |resource|
    IronBank::Resources.const_get(resource).reset_store
  end
end
retry_options() click to toggle source
# File lib/iron_bank/configuration.rb, line 84
def retry_options
  @retry_options ||= IronBank::Client::DEFAULT_RETRY_OPTIONS
end
schema_directory=(value) click to toggle source
# File lib/iron_bank/configuration.rb, line 48
def schema_directory=(value)
  @schema_directory = value

  return unless defined? IronBank::Schema

  IronBank::Schema.reset

  # Call `with_schema` on each resource to redefine accessors
  IronBank::Resources.constants.each do |resource|
    klass = IronBank::Resources.const_get(resource)
    klass.with_schema if klass.is_a?(Class)
  end
end