Module: Invoicexpress::Configuration
- Included in:
- Invoicexpress
- Defined in:
- lib/invoicexpress/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :faraday_config_block, :api_endpoint, :screen_name, :proxy, :api_key, :user_agent ].freeze
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_API_ENDPOINT =
ENV['INVOICEXPRESS_API_ENDPOINT'] || 'https://%s.invoicexpress.net/'
- DEFAULT_USER_AGENT =
"Invoicexpress Ruby Gem #{Invoicexpress::VERSION}".freeze
Class Method Summary collapse
Instance Method Summary collapse
- #api_endpoint=(value) ⇒ Object
- #configure {|_self| ... } ⇒ Object
- #faraday_config(&block) ⇒ Object
- #options ⇒ Object
- #reset ⇒ Object
Class Method Details
.extended(base) ⇒ Object
22 23 24 |
# File 'lib/invoicexpress/configuration.rb', line 22 def self.extended(base) base.reset end |
Instance Method Details
#api_endpoint=(value) ⇒ Object
34 35 36 |
# File 'lib/invoicexpress/configuration.rb', line 34 def api_endpoint=(value) @api_endpoint = File.join(value, "") end |
#configure {|_self| ... } ⇒ Object
26 27 28 |
# File 'lib/invoicexpress/configuration.rb', line 26 def configure yield self end |
#faraday_config(&block) ⇒ Object
38 39 40 |
# File 'lib/invoicexpress/configuration.rb', line 38 def faraday_config(&block) @faraday_config_block = block end |
#options ⇒ Object
30 31 32 |
# File 'lib/invoicexpress/configuration.rb', line 30 def VALID_OPTIONS_KEYS.inject({}) { |o,k| o.merge!(k => send(k)) } end |
#reset ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/invoicexpress/configuration.rb', line 42 def reset self.adapter = DEFAULT_ADAPTER self.api_endpoint = DEFAULT_API_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.api_key = nil self.screen_name = nil self.proxy = nil end |