Class: IronBank::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_bank/configuration.rb

Overview

The Zuora configuration class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



43
44
45
46
47
48
49
50
# File 'lib/iron_bank/configuration.rb', line 43

def initialize
  @schema_directory   = "./config/schema"
  @export_directory   = "./config/export"
  @logger             = IronBank::Logger.new
  @auth_type          = "token"
  @middlewares        = []
  @api_minor_version  = "211.0"
end

Instance Attribute Details

#api_minor_versionObject

Specify a minor version



41
42
43
# File 'lib/iron_bank/configuration.rb', line 41

def api_minor_version
  @api_minor_version
end

#auth_typeObject

Auth type (cookie|token)



23
24
25
# File 'lib/iron_bank/configuration.rb', line 23

def auth_type
  @auth_type
end

#cacheObject

Cache store instance, optionally used by certain resources.



26
27
28
# File 'lib/iron_bank/configuration.rb', line 26

def cache
  @cache
end

#client_idObject

OAuth client ID associated with our platform admin user.



17
18
19
# File 'lib/iron_bank/configuration.rb', line 17

def client_id
  @client_id
end

#client_secretObject

OAuth client secret.



20
21
22
# File 'lib/iron_bank/configuration.rb', line 20

def client_secret
  @client_secret
end

#domainObject

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



14
15
16
# File 'lib/iron_bank/configuration.rb', line 14

def domain
  @domain
end

#excluded_fields_fileObject

File path for excluded fields (when querying using ZOQL)



29
30
31
# File 'lib/iron_bank/configuration.rb', line 29

def excluded_fields_file
  @excluded_fields_file
end

#export_directoryObject

Directory where the local records are exported.



35
36
37
# File 'lib/iron_bank/configuration.rb', line 35

def export_directory
  @export_directory
end

#loggerObject

Logger



11
12
13
# File 'lib/iron_bank/configuration.rb', line 11

def logger
  @logger
end

#middlewaresObject

middlewares



8
9
10
# File 'lib/iron_bank/configuration.rb', line 8

def middlewares
  @middlewares
end

#schema_directoryObject

Directory where the XML describe files are located.



32
33
34
# File 'lib/iron_bank/configuration.rb', line 32

def schema_directory
  @schema_directory
end

#users_fileObject

File path for Zuora users export



38
39
40
# File 'lib/iron_bank/configuration.rb', line 38

def users_file
  @users_file
end

Instance Method Details

#credentialsObject



75
76
77
78
79
80
81
82
# File 'lib/iron_bank/configuration.rb', line 75

def credentials
  {
    domain:        domain,
    client_id:     client_id,
    client_secret: client_secret,
    auth_type:     auth_type
  }
end

#credentials?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/iron_bank/configuration.rb', line 84

def credentials?
  credentials.values.all?
end

#excluded_fieldsObject



92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/iron_bank/configuration.rb', line 92

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 ||= Psych.load_file(excluded_fields_file).tap do |fields|
    raise "Excluded fields must be a hash" unless fields.is_a?(Hash)
  end
end

#retry_optionsObject



88
89
90
# File 'lib/iron_bank/configuration.rb', line 88

def retry_options
  @retry_options ||= IronBank::Client::DEFAULT_RETRY_OPTIONS
end