Class: TwitterTweetBot::Configuration

Inherits:
Object
  • Object
show all
Includes:
TwitterTweetBot::Cache::ConfigurationExt
Defined in:
lib/twitter_tweet_bot/configuration.rb

Instance Attribute Summary collapse

Attributes included from TwitterTweetBot::Cache::ConfigurationExt

#cache, #cache_provider

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, client_id: nil, client_secret: nil, redirect_uri: nil, scopes: []) {|_self| ... } ⇒ Configuration

Returns a new instance of Configuration.

Yields:

  • (_self)

Yield Parameters:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/twitter_tweet_bot/configuration.rb', line 9

def initialize(
  name: nil,
  client_id: nil,
  client_secret: nil,
  redirect_uri: nil,
  scopes: []
)
  @name = name
  @client_id = client_id
  @client_secret = client_secret
  @redirect_uri = redirect_uri
  @scopes = scopes

  yield self if block_given?
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



3
4
5
# File 'lib/twitter_tweet_bot/configuration.rb', line 3

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



3
4
5
# File 'lib/twitter_tweet_bot/configuration.rb', line 3

def client_secret
  @client_secret
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/twitter_tweet_bot/configuration.rb', line 3

def name
  @name
end

#redirect_uriObject

Returns the value of attribute redirect_uri.



3
4
5
# File 'lib/twitter_tweet_bot/configuration.rb', line 3

def redirect_uri
  @redirect_uri
end

#scopesObject

Returns the value of attribute scopes.



3
4
5
# File 'lib/twitter_tweet_bot/configuration.rb', line 3

def scopes
  @scopes
end

Instance Method Details

#to_hashObject



25
26
27
28
29
# File 'lib/twitter_tweet_bot/configuration.rb', line 25

def to_hash
  instance_variables.each_with_object({}) do |key, hash|
    hash[key[1..].to_sym] = instance_variable_get(key)
  end
end