Module: Plaid::Client::Configurations::ClassMethods
- Defined in:
- lib/plaid/client/configuration.rb
Instance Method Summary collapse
- #add_config(name) ⇒ Object
- #configure {|_self| ... } ⇒ Object
-
#reset_config ⇒ Object
sets configuration to defaults These will probably cause your application to fail, and you should change them.
Instance Method Details
#add_config(name) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/plaid/client/configuration.rb', line 25 def add_config(name) class_eval <<-RUBY, __FILE__, __LINE__ + 1 def self.#{name}(value=nil) @#{name} = value if value return @#{name} if self.object_id == #{self.object_id} || defined?(@#{name}) name = superclass.#{name} return nil if name.nil? && !instance_variable_defined?("@#{name}") @#{name} = name && !name.is_a?(Module) && !name.is_a?(Symbol) && !name.is_a?(Numeric) && !name.is_a?(TrueClass) && !name.is_a?(FalseClass) ? name.dup : name end def self.#{name}=(value) @#{name} = value end def #{name}=(value) @#{name} = value end def #{name} value = @#{name} if instance_variable_defined?(:@#{name}) value = self.class.#{name} unless instance_variable_defined?(:@#{name}) if value.instance_of?(Proc) value.arity >= 1 ? value.call(self) : value.call else value end end RUBY end |
#configure {|_self| ... } ⇒ Object
56 57 58 |
# File 'lib/plaid/client/configuration.rb', line 56 def configure yield self end |
#reset_config ⇒ Object
sets configuration to defaults These will probably cause your application to fail, and you should change them.
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/plaid/client/configuration.rb', line 64 def reset_config configure do |config| config.client_id = 'JUNK' config.secret = 'JUNK' config.endpoint = 'https://tartan.plaid.com/' config.certpath = 'ca-bundle.crt' config.headers = {'Content-Type'=>'application/x-www-form-urlencoded'} config.webhook_address = 'http://domain.com/plaid_webhook/antennas' config.save_full_response = true end end |