Class: WordstreamClient::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/wordstream_client/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



20
21
22
23
24
# File 'lib/wordstream_client/config.rb', line 20

def initialize(options = {})
  [:username, :password, :session_id].each do |var| 
    instance_variable_set "@#{var}", options[var]
  end
end

Class Attribute Details

.passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/wordstream_client/config.rb', line 6

def password
  @password
end

.session_idObject

Returns the value of attribute session_id.



6
7
8
# File 'lib/wordstream_client/config.rb', line 6

def session_id
  @session_id
end

.usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/wordstream_client/config.rb', line 6

def username
  @username
end

Class Method Details

.clientObject



16
17
18
# File 'lib/wordstream_client/config.rb', line 16

def self.client
  Client.new instantiate
end

.instantiateObject

Instantiate new instance



12
13
14
# File 'lib/wordstream_client/config.rb', line 12

def self.instantiate
  new( :username => username, :password => password, :session_id => session_id )
end

Instance Method Details

#default_hostObject



43
44
45
# File 'lib/wordstream_client/config.rb', line 43

def default_host
  'http://api.wordstream.com'
end

#passwordObject



30
31
32
# File 'lib/wordstream_client/config.rb', line 30

def password
  @password
end

#session_idObject



34
35
36
# File 'lib/wordstream_client/config.rb', line 34

def session_id
  @session_id
end

#session_id=(new_session) ⇒ Object



38
39
40
41
# File 'lib/wordstream_client/config.rb', line 38

def session_id=(new_session)
  instance_variable_set "@session_id", new_session
  self.class.session_id = new_session
end

#usernameObject



26
27
28
# File 'lib/wordstream_client/config.rb', line 26

def username
  @username
end