Class: Tacokit::Configuration
- Inherits:
-
Object
- Object
- Tacokit::Configuration
- Defined in:
- lib/tacokit/configuration.rb
Constant Summary collapse
- API_URL =
"https://api.trello.com".freeze
- WEB_URL =
"https://trello.com".freeze
- API_VERSION =
"1".freeze
Class Method Summary collapse
Instance Method Summary collapse
- #app_authenticated? ⇒ Boolean
- #app_credentials ⇒ Object
-
#initialize(opts = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #options=(opts) ⇒ Object
- #stack {|@stack| ... } ⇒ Object
- #user_authenticated? ⇒ Boolean
- #user_credentials ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Configuration
Returns a new instance of Configuration.
24 25 26 |
# File 'lib/tacokit/configuration.rb', line 24 def initialize(opts = {}) self. = defaults.merge(opts) end |
Class Method Details
.keys ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |
Instance Method Details
#app_authenticated? ⇒ Boolean
40 41 42 |
# File 'lib/tacokit/configuration.rb', line 40 def app_authenticated? app_key && app_token end |
#app_credentials ⇒ Object
44 45 46 |
# 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) ⇒ Object
28 29 30 |
# File 'lib/tacokit/configuration.rb', line 28 def (opts) opts.each { |key, value| instance_variable_set("@#{key}", value) } end |
#stack {|@stack| ... } ⇒ Object
48 49 50 51 52 |
# 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? ⇒ Boolean
32 33 34 |
# File 'lib/tacokit/configuration.rb', line 32 def user_authenticated? app_key && oauth_token end |
#user_credentials ⇒ Object
36 37 38 |
# 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 |