oh 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -1
- data/bin/oh +4 -1
- data/lib/oh.rb +6 -4
- metadata +8 -24
data/README.rdoc
CHANGED
@@ -26,7 +26,7 @@ Currently provides a mechanism for pulling stock and option quotes.
|
|
26
26
|
account = o.accounts.detect { |a| a.virtual? }
|
27
27
|
o.account_id = account.id
|
28
28
|
|
29
|
-
# Bask
|
29
|
+
# Bask in the glory of knowing the latest price for the
|
30
30
|
# iPath Dow Jones-AIG Coffee Total Return Sub-Index ETN.
|
31
31
|
p o.quote("JO")
|
32
32
|
|
@@ -34,6 +34,8 @@ Currently provides a mechanism for pulling stock and option quotes.
|
|
34
34
|
# token will expire.
|
35
35
|
o.keep_alive
|
36
36
|
|
37
|
+
Take a look at the contents of bin/oh for further inspiration.
|
38
|
+
|
37
39
|
== Requirements
|
38
40
|
|
39
41
|
* Nokogiri
|
data/bin/oh
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'rubygems'
|
3
4
|
require 'oh'
|
4
5
|
require 'ohbjects'
|
5
6
|
Ohbjects.activate
|
6
7
|
|
7
8
|
username, *symbols = ARGV
|
8
9
|
|
9
|
-
|
10
|
+
unless username and !symbols.empty?
|
11
|
+
abort "Usage: #{File.basename($0)} [username] [symbol ...]"
|
12
|
+
end
|
10
13
|
|
11
14
|
begin
|
12
15
|
print "Password: "
|
data/lib/oh.rb
CHANGED
@@ -8,10 +8,12 @@ require 'rubygems'
|
|
8
8
|
require 'nokogiri'
|
9
9
|
|
10
10
|
class Oh
|
11
|
-
VERSION = '1.0.
|
11
|
+
VERSION = '1.0.2'
|
12
|
+
|
13
|
+
HOST = "www2.optionshouse.com"
|
12
14
|
|
13
15
|
HEADERS = {
|
14
|
-
"Host" =>
|
16
|
+
"Host" => HOST,
|
15
17
|
"User-Agent" => "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)",
|
16
18
|
"Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
17
19
|
"Accept-Language" => "en-us,en;q=0.5",
|
@@ -19,7 +21,7 @@ class Oh
|
|
19
21
|
"Accept-Charset" => "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
|
20
22
|
"Connection" => "keep-alive",
|
21
23
|
"Content-Type" => "text/xml; charset=UTF-8",
|
22
|
-
"Referer" => "https://www.optionshouse.com/tool/login/",
|
24
|
+
"Referer" => "https://www.optionshouse.com/securehost/tool/login/",
|
23
25
|
"Cookie" => "blackbird={pos:1,size:0,load:null,info:true,debug:true,warn:true,error:true,profile:true}",
|
24
26
|
"Pragma" => "no-cache",
|
25
27
|
"Cache-Control" => "no-cache",
|
@@ -185,7 +187,7 @@ class Oh
|
|
185
187
|
def connection
|
186
188
|
return @client if defined? @client
|
187
189
|
|
188
|
-
client = Net::HTTP.new(
|
190
|
+
client = Net::HTTP.new(HOST, 443)
|
189
191
|
client.use_ssl = true
|
190
192
|
|
191
193
|
if ENV["SSL_PATH"] && File.exist?(ENV["SSL_PATH"])
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew A. Smith
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-25 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -33,37 +33,21 @@ dependencies:
|
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: hoe
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 47
|
44
44
|
segments:
|
45
45
|
- 2
|
46
|
+
- 8
|
46
47
|
- 0
|
47
|
-
|
48
|
-
version: 2.0.4
|
48
|
+
version: 2.8.0
|
49
49
|
type: :development
|
50
50
|
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: hoe
|
53
|
-
prerelease: false
|
54
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 19
|
60
|
-
segments:
|
61
|
-
- 2
|
62
|
-
- 7
|
63
|
-
- 0
|
64
|
-
version: 2.7.0
|
65
|
-
type: :development
|
66
|
-
version_requirements: *id003
|
67
51
|
description: |-
|
68
52
|
An API for OptionsHouse (http://optionshouse.com).
|
69
53
|
|