Class: Trello::Configuration
- Inherits:
-
Object
- Object
- Trello::Configuration
- Defined in:
- lib/trello/configuration.rb
Constant Summary collapse
- CONFIGURABLE_ATTRIBUTES =
[ :developer_public_key, :member_token, :consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret, :callback, :return_url ]
Class Method Summary collapse
Instance Method Summary collapse
- #attributes=(attrs = {}) ⇒ Object
- #basic? ⇒ Boolean
- #credentials ⇒ Object
- #http_client ⇒ Object
- #http_client=(http_client) ⇒ Object
-
#initialize(attrs = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #oauth? ⇒ Boolean
Constructor Details
#initialize(attrs = {}) ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 |
# File 'lib/trello/configuration.rb', line 20 def initialize(attrs = {}) self.attributes = attrs end |
Class Method Details
.configurable_attributes ⇒ Object
16 17 18 |
# File 'lib/trello/configuration.rb', line 16 def self.configurable_attributes CONFIGURABLE_ATTRIBUTES end |
Instance Method Details
#attributes=(attrs = {}) ⇒ Object
24 25 26 |
# File 'lib/trello/configuration.rb', line 24 def attributes=(attrs = {}) attrs.each { |key, value| instance_variable_set("@#{key}", value) } end |
#basic? ⇒ Boolean
43 44 45 |
# File 'lib/trello/configuration.rb', line 43 def basic? developer_public_key && member_token end |
#credentials ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/trello/configuration.rb', line 28 def credentials case when oauth? oauth_credentials when basic? basic_credentials else {} end end |
#http_client ⇒ Object
51 52 53 |
# File 'lib/trello/configuration.rb', line 51 def http_client Trello::HTTP_CLIENTS.find { |k, v| v == Trello.http_client }[0] end |
#http_client=(http_client) ⇒ Object
47 48 49 |
# File 'lib/trello/configuration.rb', line 47 def http_client=(http_client) Trello.http_client = http_client.to_s end |
#oauth? ⇒ Boolean
39 40 41 |
# File 'lib/trello/configuration.rb', line 39 def oauth? consumer_key && consumer_secret end |