class Trello::Configuration

Constants

CONFIGURABLE_ATTRIBUTES

Public Class Methods

configurable_attributes() click to toggle source
# File lib/trello/configuration.rb, line 16
def self.configurable_attributes
  CONFIGURABLE_ATTRIBUTES
end
new(attrs = {}) click to toggle source
# File lib/trello/configuration.rb, line 20
def initialize(attrs = {})
  self.attributes = attrs
end

Public Instance Methods

attributes=(attrs = {}) click to toggle source
# File lib/trello/configuration.rb, line 24
def attributes=(attrs = {})
  attrs.each { |key, value| instance_variable_set("@#{key}", value) }
end
basic?() click to toggle source
# File lib/trello/configuration.rb, line 43
def basic?
  developer_public_key && member_token
end
credentials() click to toggle source
# File lib/trello/configuration.rb, line 28
def credentials
  case
  when oauth?
    oauth_credentials
  when basic?
    basic_credentials
  else
    {}
  end
end
oauth?() click to toggle source
# File lib/trello/configuration.rb, line 39
def oauth?
  consumer_key && consumer_secret
end

Private Instance Methods

basic_credentials() click to toggle source
# File lib/trello/configuration.rb, line 60
def basic_credentials
  {
    developer_public_key: developer_public_key,
    member_token: member_token
  }
end
oauth_credentials() click to toggle source
# File lib/trello/configuration.rb, line 49
def oauth_credentials
  {
    consumer_key: consumer_key,
    consumer_secret: consumer_secret,
    oauth_token: oauth_token,
    oauth_token_secret: oauth_token_secret,
    return_url: return_url,
    callback: callback,
  }.delete_if { |key, value| value.nil? }
end