Module: TicketingHub::Configuration
- Included in:
- TicketingHub
- Defined in:
- lib/ticketing_hub/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :faraday_config_block, :api_endpoint, :client_id, :client_secret, :access_token, :refresh_token, :expires_at, :proxy, :user_agent, :request_host].freeze
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_API_ENDPOINT =
ENV['TH_API_ENDPOINT'] || 'https://api.ticketinghub.com/'
- DEFAULT_USER_AGENT =
"TicketingHub Ruby Gem #{TicketingHub::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
26 27 28 |
# File 'lib/ticketing_hub/configuration.rb', line 26 def self.extended base base.reset end |
Instance Method Details
#api_endpoint=(value) ⇒ Object
40 41 42 |
# File 'lib/ticketing_hub/configuration.rb', line 40 def api_endpoint= value @api_endpoint = File.join value, '' end |
#configure {|_self| ... } ⇒ Object
30 31 32 |
# File 'lib/ticketing_hub/configuration.rb', line 30 def configure yield self end |
#faraday_config(&block) ⇒ Object
44 45 46 |
# File 'lib/ticketing_hub/configuration.rb', line 44 def faraday_config &block @faraday_config_block = block end |
#options ⇒ Object
34 35 36 37 38 |
# File 'lib/ticketing_hub/configuration.rb', line 34 def VALID_OPTIONS_KEYS.each_with_object Hash.new do |key, memo| memo[key] = send key end end |
#reset ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/ticketing_hub/configuration.rb', line 48 def reset self.adapter = DEFAULT_ADAPTER self.api_endpoint = DEFAULT_API_ENDPOINT self.client_id = nil self.client_secret = nil self.access_token = nil self.refresh_token = nil self.proxy = nil self.request_host = nil self.user_agent = DEFAULT_USER_AGENT end |