Class: Distant::Config
- Inherits:
-
Object
- Object
- Distant::Config
- Defined in:
- lib/distant/config.rb
Instance Attribute Summary collapse
-
#auth_header_generator ⇒ Object
Returns the value of attribute auth_header_generator.
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#default_header_generator ⇒ Object
Returns the value of attribute default_header_generator.
Instance Method Summary collapse
- #auth_headers(body = nil) ⇒ Object
- #default_headers(body = nil) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #set_authentication_headers_with(&block) ⇒ Object
- #set_default_headers_with(&block) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 9 10 11 |
# File 'lib/distant/config.rb', line 6 def initialize # Default just returns an empty hash: self.auth_header_generator = Proc.new{ {} } self.default_header_generator = Proc.new{ {} } self.debug = false end |
Instance Attribute Details
#auth_header_generator ⇒ Object
Returns the value of attribute auth_header_generator.
4 5 6 |
# File 'lib/distant/config.rb', line 4 def auth_header_generator @auth_header_generator end |
#base_uri ⇒ Object
Returns the value of attribute base_uri.
4 5 6 |
# File 'lib/distant/config.rb', line 4 def base_uri @base_uri end |
#debug ⇒ Object
Returns the value of attribute debug.
4 5 6 |
# File 'lib/distant/config.rb', line 4 def debug @debug end |
#default_header_generator ⇒ Object
Returns the value of attribute default_header_generator.
4 5 6 |
# File 'lib/distant/config.rb', line 4 def default_header_generator @default_header_generator end |
Instance Method Details
#auth_headers(body = nil) ⇒ Object
27 28 29 |
# File 'lib/distant/config.rb', line 27 def auth_headers(body=nil) auth_header_generator.call(body) end |
#default_headers(body = nil) ⇒ Object
23 24 25 |
# File 'lib/distant/config.rb', line 23 def default_headers(body=nil) self.default_header_generator.call(body) end |
#set_authentication_headers_with(&block) ⇒ Object
13 14 15 16 |
# File 'lib/distant/config.rb', line 13 def set_authentication_headers_with(&block) raise ArgumentError.new 'block required' unless block_given? self.auth_header_generator = block end |
#set_default_headers_with(&block) ⇒ Object
18 19 20 21 |
# File 'lib/distant/config.rb', line 18 def set_default_headers_with(&block) raise ArgumentError.new 'block required' unless block_given? self.default_header_generator = block end |