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
- #user_authenticated? ⇒ Boolean
- #user_credentials ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 |
# File 'lib/tacokit/configuration.rb', line 22 def initialize(opts = {}) self. = defaults.merge(opts) end |
Class Method Details
.keys ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tacokit/configuration.rb', line 8 def self.keys [ :app_key, :app_secret, :app_token, :oauth_token, :oauth_secret, :api_endpoint, :web_endpoint ] end |
Instance Method Details
#app_authenticated? ⇒ Boolean
38 39 40 |
# File 'lib/tacokit/configuration.rb', line 38 def app_authenticated? app_key && app_token end |
#app_credentials ⇒ Object
42 43 44 |
# File 'lib/tacokit/configuration.rb', line 42 def app_credentials { key: app_key, token: app_token }.delete_if { |k, v| v.nil? } end |
#options=(opts) ⇒ Object
26 27 28 |
# File 'lib/tacokit/configuration.rb', line 26 def (opts) opts.each { |key, value| instance_variable_set("@#{key}", value) } end |
#user_authenticated? ⇒ Boolean
30 31 32 |
# File 'lib/tacokit/configuration.rb', line 30 def user_authenticated? app_key && oauth_token end |
#user_credentials ⇒ Object
34 35 36 |
# File 'lib/tacokit/configuration.rb', line 34 def user_credentials { consumer_key: app_key, token: oauth_token }.delete_if { |k, v| v.nil? } end |