Module: Alphapoint

Defined in:
lib/alphapoint.rb,
lib/alphapoint/version.rb,
lib/alphapoint/get_quotes.rb,
lib/alphapoint/web_socket.rb,
lib/alphapoint/configuration.rb

Defined Under Namespace

Modules: Call Classes: AlphapointError, Configuration, GetQuotes, WebSocket

Constant Summary collapse

VERSION =
"0.1.7"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



39
40
41
# File 'lib/alphapoint.rb', line 39

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



50
51
52
# File 'lib/alphapoint.rb', line 50

def self.configure
	yield(configuration)
end

.configure_with(path_to_yaml_file) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/alphapoint.rb', line 54

def self.configure_with(path_to_yaml_file)
    configure do |configuration|
    	begin
	    	config = YAML.load(IO.read(path_to_yaml_file))

		    configuration.address = config.address
			configuration.user = config.user
			configuration.password = config.password

	    rescue Errno::ENOENT
	    #  log(:warning, "YAML configuration file couldn't be found. Using defaults."); return
	    rescue Psych::SyntaxError
	    #  log(:warning, "YAML configuration file contains invalid syntax. Using defaults."); return
	    end
    end
end

.resetObject



46
47
48
# File 'lib/alphapoint.rb', line 46

def self.reset
	@configuration = Configuration.new
end

.response_of(type) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/alphapoint.rb', line 30

def self.response_of(type)
	if type == REQUEST
		REPLY
	elsif type == SUBSCRIBE
		EVENT
	end
end