class Tacokit::Configuration
Constants
- API_URL
- API_VERSION
- WEB_URL
Public Class Methods
keys()
click to toggle source
# File lib/tacokit/configuration.rb, line 9 def self.keys [ :app_key, :app_secret, :app_token, :oauth_token, :oauth_secret, :api_endpoint, :web_endpoint, :stack ] end
new(opts = {})
click to toggle source
# File lib/tacokit/configuration.rb, line 24 def initialize(opts = {}) self.options = defaults.merge(opts) end
Public Instance Methods
app_authenticated?()
click to toggle source
# File lib/tacokit/configuration.rb, line 40 def app_authenticated? app_key && app_token end
app_credentials()
click to toggle source
# File lib/tacokit/configuration.rb, line 44 def app_credentials { key: app_key, token: app_token }.delete_if { |k, v| v.nil? } end
options=(opts)
click to toggle source
# File lib/tacokit/configuration.rb, line 28 def options=(opts) opts.each { |key, value| instance_variable_set("@#{key}", value) } end
stack() { |stack| ... }
click to toggle source
# File lib/tacokit/configuration.rb, line 48 def stack @stack ||= Faraday::RackBuilder.new(&Middleware.default_stack(self)) yield @stack if block_given? @stack end
user_authenticated?()
click to toggle source
# File lib/tacokit/configuration.rb, line 32 def user_authenticated? app_key && oauth_token end
user_credentials()
click to toggle source
# File lib/tacokit/configuration.rb, line 36 def user_credentials { consumer_key: app_key, consumer_secret: app_secret, token: oauth_token }.delete_if { |k, v| v.nil? } end
Private Instance Methods
defaults()
click to toggle source
# File lib/tacokit/configuration.rb, line 56 def defaults { api_endpoint: File.join(API_URL, API_VERSION), web_endpoint: File.join(WEB_URL, API_VERSION), app_key: ENV["TRELLO_APP_KEY"], app_secret: ENV["TRELLO_APP_SECRET"], app_token: ENV["TRELLO_APP_TOKEN"] } end