Module: StockTwits

Defined in:
lib/stocktwits.rb

Constant Summary collapse

BASE_URL =
"http://api.stocktwits.com"

Class Method Summary collapse

Class Method Details

.stream(name = "public") ⇒ Object



14
15
16
17
18
19
# File 'lib/stocktwits.rb', line 14

def self.stream(name="public")

  response = @connection.get("/api/streams/#{name}.json")
  response.body

end

.symbol(name = "AAPL") ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/stocktwits.rb', line 28

def self.symbol(name="AAPL")

  if name && name.split(",").length > 1
    response = @connection.get("/api/streams/symbols.json?symbols=#{name}")
  else
    response = @connection.get("/api/streams/symbol/#{name}.json")
  end

  response.body

end

.user(name = "stocktwits") ⇒ Object



21
22
23
24
25
26
# File 'lib/stocktwits.rb', line 21

def self.user(name="stocktwits")

  response = @connection.get "/api/streams/user/#{name}.json"
  response.body

end