btrade 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/btrade.rb +16 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6227d1ae4501ad994aab6f787108e9e6c3bd9d2e
4
- data.tar.gz: d817316cc58410ea0eb112d377839563506bba2f
3
+ metadata.gz: d16962d9f41cb227de86cc55852a1b3f532b3c3d
4
+ data.tar.gz: c8a8dd5afa624a2f715ce205b3f17d76cb7f0df6
5
5
  SHA512:
6
- metadata.gz: 382680c372f3407d2f72b61653d8308a664c0295ac70480c28f9eafecc6e20410d6fe92e5274a7efba6631ca3d3e427e99e1deaebdddb8618003de5cd012c30d
7
- data.tar.gz: 4ae50f8b15478e8c60e073d6d2a3272c711f48eeaf2407a971ac76cd41be2d0c58aebdb34b14d1219b2031c0155b6d6db804a9dea24f5a4c84f98b3345c01849
6
+ metadata.gz: 6380f1203f44b7c4f2f8398eebd0b44d4a14a1bb0731b0bcbb9acdb91998875101372ac0b9a6010bcecf07612e31e3b8a69b0089b65bc95f842ea67e22e6b8f7
7
+ data.tar.gz: 2a5f9bb509105f0d5bb0e6ad8e2dd6d594a21e4c9406d828c02f71ba6909824ca6a36a7fcd2aafedffb6343287b1fa69a61431253d88124b9a7b52822646526d
@@ -9,27 +9,28 @@ module Btrade
9
9
  mattr_accessor :conn
10
10
  mattr_accessor :consumer
11
11
 
12
- def self.initialize!
13
- @@conn = Faraday.new(:url => 'http://sushi.com') do |faraday|
14
- faraday.request :url_encoded # form-encode POST params
15
- faraday.response :logger # log requests to STDOUT
16
- faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
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
- @@consumer = OAuth::Consumer.new(consumer_key[:token], consumer_key[:secret], {:site => "https://etws.etrade.com", :http_method => :get})
20
-
21
- self
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
- def get_request_token
29
- @@consumer.get_request_token()
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: btrade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Adamson