localbitcoins 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +13 -5
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +16 -19
  4. data/README.md +319 -35
  5. data/Rakefile +1 -1
  6. data/lib/localbitcoins/client/ads.rb +45 -9
  7. data/lib/localbitcoins/client/contacts.rb +66 -0
  8. data/lib/localbitcoins/client/escrows.rb +8 -12
  9. data/lib/localbitcoins/client/markets.rb +27 -0
  10. data/lib/localbitcoins/client/public.rb +78 -0
  11. data/lib/localbitcoins/client/users.rb +16 -0
  12. data/lib/localbitcoins/client/wallet.rb +28 -0
  13. data/lib/localbitcoins/client.rb +13 -1
  14. data/lib/localbitcoins/request.rb +11 -15
  15. data/lib/localbitcoins/version.rb +1 -1
  16. data/localbitcoins.gemspec +3 -3
  17. data/spec/client_spec.rb +397 -8
  18. data/spec/fixtures/account_info.json +14 -0
  19. data/spec/fixtures/ad_create.json +5 -0
  20. data/spec/fixtures/ad_list.json +103 -0
  21. data/spec/fixtures/ad_single.json +55 -0
  22. data/spec/fixtures/ad_update.json +5 -0
  23. data/spec/fixtures/ads.json +103 -0
  24. data/spec/fixtures/contact_message.json +5 -0
  25. data/spec/fixtures/contacts.json +52 -0
  26. data/spec/fixtures/contacts_active.json +165 -0
  27. data/spec/fixtures/contacts_active_buyers.json +60 -0
  28. data/spec/fixtures/contacts_active_sellers.json +111 -0
  29. data/spec/fixtures/contacts_cancel.json +5 -0
  30. data/spec/fixtures/contacts_canceled_contacts.json +162 -0
  31. data/spec/fixtures/contacts_closed_contacts.json +109 -0
  32. data/spec/fixtures/contacts_contact_info.json +52 -0
  33. data/spec/fixtures/contacts_contacts_info.json +111 -0
  34. data/spec/fixtures/contacts_create.json +10 -0
  35. data/spec/fixtures/contacts_messages.json +43 -0
  36. data/spec/fixtures/contacts_released_contacts.json +60 -0
  37. data/spec/fixtures/currencies.json +505 -0
  38. data/spec/fixtures/currency_ticker.json +236 -0
  39. data/spec/fixtures/escrow_release.json +5 -0
  40. data/spec/fixtures/escrows.json +24 -22
  41. data/spec/fixtures/local_buy_ads.json +93 -0
  42. data/spec/fixtures/local_sell_ads.json +93 -0
  43. data/spec/fixtures/logout.json +0 -0
  44. data/spec/fixtures/myself.json +14 -0
  45. data/spec/fixtures/online_buy_ads.json +637 -0
  46. data/spec/fixtures/online_sell_ads.json +2160 -0
  47. data/spec/fixtures/orderbook.json +1739 -0
  48. data/spec/fixtures/payment_methods.json +95 -0
  49. data/spec/fixtures/places.json +15 -0
  50. data/spec/fixtures/ticker.json +254 -0
  51. data/spec/fixtures/trades.json +3002 -0
  52. data/spec/fixtures/wallet.json +34 -0
  53. data/spec/fixtures/wallet_addr.json +6 -0
  54. data/spec/fixtures/wallet_balance.json +16 -0
  55. data/spec/fixtures/wallet_send.json +5 -0
  56. data/spec/spec_helper.rb +26 -29
  57. metadata +51 -7
@@ -0,0 +1,34 @@
1
+ {
2
+ "data": {
3
+ "message": "OK",
4
+ "total": {
5
+ "balance": "0.05",
6
+ "sendable": "0.05"
7
+ },
8
+ "sent_transactions_30d": [
9
+ {
10
+ "txid": "12345",
11
+ "amount": "0.05",
12
+ "description": "Internal send",
13
+ "tx_type": 5,
14
+ "created_at": "2014-12-20T15:27:36+00:00"
15
+ }
16
+ ],
17
+ "received_transactions_30d": [
18
+ {
19
+ "txid": "67890",
20
+ "amount": "1.02",
21
+ "description": "Internal send",
22
+ "tx_type": 5,
23
+ "created_at": "2014-11-20T15:12:22+00:00"
24
+ }
25
+ ],
26
+ "receiving_address_count": 1,
27
+ "receiving_address_list": [
28
+ {
29
+ "address": "15HfUY9LwwewaWwrKRXzE91tjDnHmye1hc",
30
+ "received": "1.02"
31
+ }
32
+ ]
33
+ }
34
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "data": {
3
+ "address": "15HfUY9LwwewaWwrKRXzE91tjDnHmy2d2hc",
4
+ "message": "OK!"
5
+ }
6
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "data": {
3
+ "message": "ok",
4
+ "receiving_address_count": 1,
5
+ "receiving_address_list": [
6
+ {
7
+ "address": "15HfUY9LwwewaWwrKRXzE91tjDnHmye1hc",
8
+ "received": "0.0"
9
+ }
10
+ ],
11
+ "total": {
12
+ "balance": "0.05",
13
+ "sendable": "0.05"
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "data": {
3
+ "message": "Money is being sent"
4
+ }
5
+ }
data/spec/spec_helper.rb CHANGED
@@ -5,41 +5,38 @@ require 'rest-client'
5
5
  require 'webmock'
6
6
  require 'webmock/rspec'
7
7
 
8
+ WebMock.disable_net_connect!(allow_localhost: true)
9
+
8
10
  RSpec.configure do |config|
9
- config.color_enabled = true
11
+ config.color = true
12
+ end
13
+
14
+ def stub_get(path, fixture_name, params={})
15
+ stub_request(:get, api_url(path)).
16
+ with(:query => {"Accept" => "application/json", "access_token" => "ACCESS_TOKEN"}.merge!(params),
17
+ :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
18
+ 'Authorization'=>'Bearer ACCESS_TOKEN','Content-Type'=>'application/x-www-form-urlencoded',
19
+ 'User-Agent'=>'Faraday v0.9.0'}).to_return(:status => 200, :body => fixture(fixture_name),
20
+ :headers => {})
10
21
  end
11
22
 
12
- def stub_get(path, fixture_name)
13
- stub_request(:get, "https://www.localbitcoins.com/api/escrows").
14
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer ACCESS_TOKEN', 'User-Agent'=>'Faraday v0.8.7'}).
15
- to_return(:status => 200, :body => fixture(fixture_name), :headers => {})
16
- # stub_request(:get, api_url(path)).
17
- # with(
18
- # headers: {
19
- # 'Accept' => 'application/json',
20
- # 'Authorization' => 'Bearer ACCESS_TOKEN',
21
- # 'User-Agent' => 'Faraday v0.8.7'
22
- # }).
23
- # to_return(
24
- # status: 200,
25
- # body: fixture(fixture_name),
26
- # headers: {}
27
- # )
23
+ def stub_get_unauth(path, fixture_name)
24
+ stub_request(:get, api_url(path)).
25
+ with(
26
+ # :query => {"Accept" => "application/json"},
27
+ :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
28
+ #'Content-Type'=>'application/x-www-form-urlencoded',
29
+ 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => fixture(fixture_name),
30
+ :headers => {})
28
31
  end
29
32
 
30
33
  def stub_post(path, fixture_name)
31
- stub_request(:put, api_url(path)).
32
- with(
33
- body: {},
34
- headers: {
35
- 'Accept' => 'application/json',
36
- 'Content-Type' => 'application/json',
37
- }).
38
- to_return(
39
- status: 200,
40
- body: fixture(fixture_name),
41
- headers: {}
42
- )
34
+ stub_request(:post, api_url(path)).
35
+ with(:query => {"Accept" => "application/json", "access_token" => "ACCESS_TOKEN"},
36
+ :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
37
+ 'Authorization'=>'Bearer ACCESS_TOKEN', 'Content-Type'=>'application/x-www-form-urlencoded',
38
+ 'User-Agent'=>'Faraday v0.9.0'}).to_return(:status => 200, :body => fixture(fixture_name),
39
+ :headers => {})
43
40
  end
44
41
 
45
42
  def fixture_path(file=nil)
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localbitcoins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Shutt
8
+ - Will Newman
9
+ - Albert Brown
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2013-07-12 00:00:00.000000000 Z
13
+ date: 2014-07-09 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: rspec
@@ -100,17 +102,19 @@ dependencies:
100
102
  requirements:
101
103
  - - ~>
102
104
  - !ruby/object:Gem::Version
103
- version: 0.9.2
105
+ version: 0.9.4
104
106
  type: :runtime
105
107
  prerelease: false
106
108
  version_requirements: !ruby/object:Gem::Requirement
107
109
  requirements:
108
110
  - - ~>
109
111
  - !ruby/object:Gem::Version
110
- version: 0.9.2
112
+ version: 0.9.4
111
113
  description: Ruby wrapper for the LocalBitcoins API
112
114
  email:
113
115
  - john.d.shutt@gmail.com
116
+ - will.newman@rutgers.edu
117
+ - albert_brown@brown.edu
114
118
  executables: []
115
119
  extensions: []
116
120
  extra_rdoc_files: []
@@ -123,16 +127,56 @@ files:
123
127
  - lib/localbitcoins.rb
124
128
  - lib/localbitcoins/client.rb
125
129
  - lib/localbitcoins/client/ads.rb
130
+ - lib/localbitcoins/client/contacts.rb
126
131
  - lib/localbitcoins/client/escrows.rb
132
+ - lib/localbitcoins/client/markets.rb
133
+ - lib/localbitcoins/client/public.rb
134
+ - lib/localbitcoins/client/users.rb
135
+ - lib/localbitcoins/client/wallet.rb
127
136
  - lib/localbitcoins/errors.rb
128
137
  - lib/localbitcoins/request.rb
129
138
  - lib/localbitcoins/version.rb
130
139
  - localbitcoins.gemspec
131
140
  - spec/client_spec.rb
141
+ - spec/fixtures/account_info.json
142
+ - spec/fixtures/ad_create.json
143
+ - spec/fixtures/ad_list.json
144
+ - spec/fixtures/ad_single.json
145
+ - spec/fixtures/ad_update.json
132
146
  - spec/fixtures/ads.json
147
+ - spec/fixtures/contact_message.json
148
+ - spec/fixtures/contacts.json
149
+ - spec/fixtures/contacts_active.json
150
+ - spec/fixtures/contacts_active_buyers.json
151
+ - spec/fixtures/contacts_active_sellers.json
152
+ - spec/fixtures/contacts_cancel.json
153
+ - spec/fixtures/contacts_canceled_contacts.json
154
+ - spec/fixtures/contacts_closed_contacts.json
155
+ - spec/fixtures/contacts_contact_info.json
156
+ - spec/fixtures/contacts_contacts_info.json
157
+ - spec/fixtures/contacts_create.json
158
+ - spec/fixtures/contacts_messages.json
159
+ - spec/fixtures/contacts_released_contacts.json
160
+ - spec/fixtures/currencies.json
161
+ - spec/fixtures/currency_ticker.json
133
162
  - spec/fixtures/escrow_release.json
134
163
  - spec/fixtures/escrows.json
164
+ - spec/fixtures/local_buy_ads.json
165
+ - spec/fixtures/local_sell_ads.json
166
+ - spec/fixtures/logout.json
167
+ - spec/fixtures/myself.json
135
168
  - spec/fixtures/oauth_response.json
169
+ - spec/fixtures/online_buy_ads.json
170
+ - spec/fixtures/online_sell_ads.json
171
+ - spec/fixtures/orderbook.json
172
+ - spec/fixtures/payment_methods.json
173
+ - spec/fixtures/places.json
174
+ - spec/fixtures/ticker.json
175
+ - spec/fixtures/trades.json
176
+ - spec/fixtures/wallet.json
177
+ - spec/fixtures/wallet_addr.json
178
+ - spec/fixtures/wallet_balance.json
179
+ - spec/fixtures/wallet_send.json
136
180
  - spec/localbitcoins_spec.rb
137
181
  - spec/spec_helper.rb
138
182
  homepage: http://shutt.in
@@ -145,17 +189,17 @@ require_paths:
145
189
  - lib
146
190
  required_ruby_version: !ruby/object:Gem::Requirement
147
191
  requirements:
148
- - - '>='
192
+ - - ! '>='
149
193
  - !ruby/object:Gem::Version
150
194
  version: '0'
151
195
  required_rubygems_version: !ruby/object:Gem::Requirement
152
196
  requirements:
153
- - - '>='
197
+ - - ! '>='
154
198
  - !ruby/object:Gem::Version
155
199
  version: '0'
156
200
  requirements: []
157
201
  rubyforge_project:
158
- rubygems_version: 2.0.3
202
+ rubygems_version: 2.3.0
159
203
  signing_key:
160
204
  specification_version: 4
161
205
  summary: LocalBitcoins API wrapper