Sha256: 14c85cdb45306869507c039c847be6eccb13361eb35984608c703f0307f1e228
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require "twitter/error" require "twitter/utils" require "twitter/version" module Twitter class Client include Twitter::Utils attr_accessor :access_token, :access_token_secret, :consumer_key, :consumer_secret, :proxy, :timeouts, :dev_environment attr_writer :user_agent # Initializes a new Client object # # @param options [Hash] # @return [Twitter::Client] def initialize(options = {}) options.each do |key, value| instance_variable_set(:"@#{key}", value) end yield(self) if block_given? end # @return [Boolean] def user_token? !(blank_string?(access_token) || blank_string?(access_token_secret)) end # @return [String] def user_agent @user_agent ||= "TwitterRubyGem/#{Twitter::Version}" end # @return [Hash] def credentials { consumer_key:, consumer_secret:, token: access_token, token_secret: access_token_secret, } end # @return [Boolean] def credentials? credentials.values.none? { |v| blank_string?(v) } end private def blank_string?(string) string.respond_to?(:empty?) ? string.empty? : !string end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
twitter-8.1.0 | lib/twitter/client.rb |