class Twitter::Client
Attributes
access_token[RW]
access_token_secret[RW]
consumer_key[RW]
consumer_secret[RW]
dev_environment[RW]
proxy[RW]
timeouts[RW]
user_agent[W]
Public Class Methods
new(options = {}) { |self| ... }
click to toggle source
Initializes a new Client
object
@param options [Hash] @return [Twitter::Client]
# File lib/twitter/client.rb, line 15 def initialize(options = {}) options.each do |key, value| instance_variable_set("@#{key}", value) end yield(self) if block_given? end
Public Instance Methods
credentials()
click to toggle source
@return [Hash]
# File lib/twitter/client.rb, line 33 def credentials { consumer_key: consumer_key, consumer_secret: consumer_secret, token: access_token, token_secret: access_token_secret, } end
credentials?()
click to toggle source
@return [Boolean]
# File lib/twitter/client.rb, line 43 def credentials? credentials.values.none? { |v| blank_string?(v) } end
user_agent()
click to toggle source
@return [String]
# File lib/twitter/client.rb, line 28 def user_agent @user_agent ||= "TwitterRubyGem/#{Twitter::Version}" end
user_token?()
click to toggle source
@return [Boolean]
# File lib/twitter/client.rb, line 23 def user_token? !(blank_string?(access_token) || blank_string?(access_token_secret)) end
Private Instance Methods
blank_string?(string)
click to toggle source
# File lib/twitter/client.rb, line 49 def blank_string?(string) string.respond_to?(:empty?) ? string.empty? : !string end