Class: RubyTCC::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rubytcc/client.rb

Direct Known Subclasses

REST::Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ RubyTCC::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})

Yields:

  • (_self)

Yield Parameters:



13
14
15
16
17
18
19
# 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

Instance Attribute Details

#application_idString

Returns:

  • (String)


27
28
29
# File 'lib/rubytcc/client.rb', line 27

def application_id
  @application_id
end

#application_versionString

Returns:

  • (String)


32
33
34
# File 'lib/rubytcc/client.rb', line 32

def application_version
  @application_version
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/rubytcc/client.rb', line 5

def password
  @password
end

#proxyObject

Returns the value of attribute proxy.



5
6
7
# File 'lib/rubytcc/client.rb', line 5

def proxy
  @proxy
end

#ui_languageString

Returns:

  • (String)


37
38
39
# File 'lib/rubytcc/client.rb', line 37

def ui_language
  @ui_language
end

#user_agentString

Returns:

  • (String)


22
23
24
# File 'lib/rubytcc/client.rb', line 22

def user_agent
	@user_agent ||= 'Apache-HttpClient/UNAVAILABLE (java 1.4)'
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/rubytcc/client.rb', line 5

def username
  @username
end

Instance Method Details

#credentialsHash

Returns:

  • (Hash)


42
43
44
45
46
47
48
49
50
# 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?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/rubytcc/client.rb', line 53

def credentials?
	credentials.values.all?
end