class RubyTCC::Client
Attributes
application_id[RW]
application_version[RW]
password[RW]
proxy[RW]
ui_language[RW]
user_agent[W]
username[RW]
Public Class Methods
new(options = {}) { |self| ... }
click to toggle source
Initializes a new Client
object
@param options [Hash] @return [RubyTCC::Client]
# File lib/rubytcc/client.rb, line 13 def initialize(options = {}) options.each do |key, value| send(:"#{key}=", value) end yield(self) if block_given? validate_credential_type! end
Public Instance Methods
credentials()
click to toggle source
@return [Hash]
# File lib/rubytcc/client.rb, line 42 def credentials { :username => username, :password => password, :ApplicationId => self.application_id, :ApplicationVersion => self.application_version, :UiLanguage => self.ui_language } end
credentials?()
click to toggle source
@return [Boolean]
# File lib/rubytcc/client.rb, line 53 def credentials? credentials.values.all? end
user_agent()
click to toggle source
@return [String]
# File lib/rubytcc/client.rb, line 22 def user_agent @user_agent ||= 'Apache-HttpClient/UNAVAILABLE (java 1.4)' end
Private Instance Methods
validate_credential_type!()
click to toggle source
Ensures that all credentials set during configuration are of a valid type. Valid types are String and Symbol.
@raise [RubyTCC::Error::ConfigurationError] Error
is raised when
supplied twitter credentials are not a String or Symbol.
# File lib/rubytcc/client.rb, line 64 def validate_credential_type! credentials.each do |credential, value| next if value.nil? fail(RubyTCC::Error::ConfigurationError.new("Invalid #{credential} specified: #{value.inspect} must be a string or symbol.")) unless value.is_a?(String) || value.is_a?(Symbol) end end