btrade 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/btrade.rb +16 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d16962d9f41cb227de86cc55852a1b3f532b3c3d
|
4
|
+
data.tar.gz: c8a8dd5afa624a2f715ce205b3f17d76cb7f0df6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6380f1203f44b7c4f2f8398eebd0b44d4a14a1bb0731b0bcbb9acdb91998875101372ac0b9a6010bcecf07612e31e3b8a69b0089b65bc95f842ea67e22e6b8f7
|
7
|
+
data.tar.gz: 2a5f9bb509105f0d5bb0e6ad8e2dd6d594a21e4c9406d828c02f71ba6909824ca6a36a7fcd2aafedffb6343287b1fa69a61431253d88124b9a7b52822646526d
|
data/lib/btrade.rb
CHANGED
@@ -9,27 +9,28 @@ module Btrade
|
|
9
9
|
mattr_accessor :conn
|
10
10
|
mattr_accessor :consumer
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
class Consumer
|
13
|
+
def initialize(consumer_key)
|
14
|
+
@conn = Faraday.new(:url => 'http://sushi.com') do |faraday|
|
15
|
+
faraday.request :url_encoded # form-encode POST params
|
16
|
+
faraday.response :logger # log requests to STDOUT
|
17
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
18
|
+
end
|
19
|
+
|
20
|
+
@consumer = OAuth::Consumer.new(consumer_key[:token], consumer_key[:secret], {:site => "https://etws.etrade.com", :http_method => :get})
|
17
21
|
end
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
def get_auth_url(request_token)
|
25
|
-
"https://us.etrade.com/e/t/etws/authorize?key=#{escape(@@consumer.key)}5&token=#{request_token.token}"
|
26
|
-
end
|
23
|
+
def get_auth_url(request_token)
|
24
|
+
"https://us.etrade.com/e/t/etws/authorize?key=#{escape(@@consumer.key)}5&token=#{request_token.token}"
|
25
|
+
end
|
27
26
|
|
28
|
-
|
29
|
-
|
27
|
+
def get_request_token
|
28
|
+
@@consumer.get_request_token()
|
29
|
+
end
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.setup
|
33
33
|
yield self
|
34
|
+
@@consumer = Consumer.new(consumer_key)
|
34
35
|
end
|
35
36
|
end
|