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,236 @@
1
+ {
2
+ "CAD":{
3
+ "volume_btc":"61.90",
4
+ "rates":{
5
+ "last":"787.34"
6
+ },
7
+ "avg_1h":647.0721845952517,
8
+ "avg_24h":666.7569234609468,
9
+ "avg_12h":649.7801254624504
10
+ },
11
+ "USD":{
12
+ "volume_btc":"848.77",
13
+ "rates":{
14
+ "last":"883.50"
15
+ },
16
+ "avg_1h":658.717311966712,
17
+ "avg_24h":660.6697681735634,
18
+ "avg_12h":653.9013733075265
19
+ },
20
+ "INR":{
21
+ "volume_btc":"2.40",
22
+ "rates":{
23
+ "last":"33652.88"
24
+ },
25
+ "avg_1h":0,
26
+ "avg_24h":37261.6394435665,
27
+ "avg_12h":37373.05897008055
28
+ },
29
+ "GBP":{
30
+ "volume_btc":"433.95",
31
+ "rates":{
32
+ "last":"353.59"
33
+ },
34
+ "avg_1h":342.7437419784004,
35
+ "avg_24h":346.8650704392179,
36
+ "avg_12h":345.2195379126755
37
+ },
38
+ "PLN":{
39
+ "volume_btc":"11.37",
40
+ "rates":{
41
+ "last":"1683.31"
42
+ },
43
+ "avg_1h":0,
44
+ "avg_24h":1698.5976696792798,
45
+ "avg_12h":1684.106459936623
46
+ },
47
+ "MXN":{
48
+ "volume_btc":"17.00",
49
+ "rates":{
50
+ "last":"7818.84"
51
+ },
52
+ "avg_1h":7818.84,
53
+ "avg_24h":8055.796269195919,
54
+ "avg_12h":7754.315784960422
55
+ },
56
+ "ARS":{
57
+ "volume_btc":"1.25",
58
+ "rates":{
59
+ "last":"7194.93"
60
+ },
61
+ "avg_1h":0,
62
+ "avg_24h":7014.509648982209,
63
+ "avg_12h":7194.93
64
+ },
65
+ "RUB":{
66
+ "volume_btc":"8.31",
67
+ "rates":{
68
+ "last":"22309.64"
69
+ },
70
+ "avg_1h":22309.64,
71
+ "avg_24h":21697.84048178571,
72
+ "avg_12h":21500.11858426444
73
+ },
74
+ "EUR":{
75
+ "volume_btc":"113.75",
76
+ "rates":{
77
+ "last":"599.17"
78
+ },
79
+ "avg_1h":520.7618838750394,
80
+ "avg_24h":460.1081921347475,
81
+ "avg_12h":462.2639151895423
82
+ },
83
+ "CHF":{
84
+ "volume_btc":"1.55",
85
+ "rates":{
86
+ "last":"557.64"
87
+ },
88
+ "avg_1h":0,
89
+ "avg_24h":601.0533350585495,
90
+ "avg_12h":557.64
91
+ },
92
+ "HKD":{
93
+ "volume_btc":"0.27",
94
+ "rates":{
95
+ "last":"4864.97"
96
+ },
97
+ "avg_1h":0,
98
+ "avg_24h":4864.97,
99
+ "avg_12h":0
100
+ },
101
+ "SEK":{
102
+ "volume_btc":"5.10",
103
+ "rates":{
104
+ "last":"4209.50"
105
+ },
106
+ "avg_1h":0,
107
+ "avg_24h":4080.7836581779684,
108
+ "avg_12h":4124.869970884795
109
+ },
110
+ "NOK":{
111
+ "volume_btc":"11.66",
112
+ "rates":{
113
+ "last":"3857.70"
114
+ },
115
+ "avg_1h":0,
116
+ "avg_24h":3852.894959379584,
117
+ "avg_12h":3851.479565217391
118
+ },
119
+ "AUD":{
120
+ "volume_btc":"104.53",
121
+ "rates":{
122
+ "last":"631.55"
123
+ },
124
+ "avg_1h":0,
125
+ "avg_24h":641.2304253393579,
126
+ "avg_12h":669.8669155222808
127
+ },
128
+ "THB":{
129
+ "volume_btc":"20.07",
130
+ "rates":{
131
+ "last":"18897.36"
132
+ },
133
+ "avg_1h":0,
134
+ "avg_24h":18710.22103443636,
135
+ "avg_12h":18689.14829627938
136
+ },
137
+ "PEN":{
138
+ "volume_btc":"0.03",
139
+ "rates":{
140
+ "last":"2084.00"
141
+ },
142
+ "avg_1h":0,
143
+ "avg_24h":2084.0,
144
+ "avg_12h":0
145
+ },
146
+ "NZD":{
147
+ "volume_btc":"7.44",
148
+ "rates":{
149
+ "last":"696.44"
150
+ },
151
+ "avg_1h":0,
152
+ "avg_24h":724.2881545859975,
153
+ "avg_12h":696.44
154
+ },
155
+ "ZAR":{
156
+ "volume_btc":"3.84",
157
+ "rates":{
158
+ "last":"6272.28"
159
+ },
160
+ "avg_1h":0,
161
+ "avg_24h":6348.097990839059,
162
+ "avg_12h":6332.258501481662
163
+ },
164
+ "SGD":{
165
+ "volume_btc":"0.33",
166
+ "rates":{
167
+ "last":"880.00"
168
+ },
169
+ "avg_1h":0,
170
+ "avg_24h":839.7346070785843,
171
+ "avg_12h":880.0
172
+ },
173
+ "MYR":{
174
+ "volume_btc":"6.43",
175
+ "rates":{
176
+ "last":"2040.99"
177
+ },
178
+ "avg_1h":0,
179
+ "avg_24h":1987.3522439623287,
180
+ "avg_12h":2035.3012969056974
181
+ },
182
+ "CLP":{
183
+ "volume_btc":"1.07",
184
+ "rates":{
185
+ "last":"328192.33"
186
+ },
187
+ "avg_1h":0,
188
+ "avg_24h":328192.33,
189
+ "avg_12h":0
190
+ },
191
+ "JPY":{
192
+ "volume_btc":"0.61",
193
+ "rates":{
194
+ "last":"65952.55"
195
+ },
196
+ "avg_1h":0,
197
+ "avg_24h":65952.55,
198
+ "avg_12h":65952.55
199
+ },
200
+ "BRL":{
201
+ "volume_btc":"4.59",
202
+ "rates":{
203
+ "last":"1415.88"
204
+ },
205
+ "avg_1h":0,
206
+ "avg_24h":1582.5966294949144,
207
+ "avg_12h":1582.5966294949144
208
+ },
209
+ "DKK":{
210
+ "volume_btc":"0.38",
211
+ "rates":{
212
+ "last":"3451.93"
213
+ },
214
+ "avg_1h":0,
215
+ "avg_24h":3464.875775586354,
216
+ "avg_12h":3464.875775586354
217
+ },
218
+ "PHP":{
219
+ "volume_btc":"0.18",
220
+ "rates":{
221
+ "last":"27432.60"
222
+ },
223
+ "avg_1h":0,
224
+ "avg_24h":27432.6,
225
+ "avg_12h":27432.6
226
+ },
227
+ "CNY":{
228
+ "volume_btc":"0.26",
229
+ "rates":{
230
+ "last":"3811.62"
231
+ },
232
+ "avg_1h":0,
233
+ "avg_24h":3811.62,
234
+ "avg_12h":3811.62
235
+ }
236
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "data": {
3
+ "message" : "The escrow has been released successfully."
4
+ }
5
+ }
@@ -1,24 +1,26 @@
1
- { "escrow_list":
2
- [
3
- {
4
- "data": {
5
- "created_at": "2013-06-20T15:23:01.61",
6
- "buyer_username": "alice",
7
- "reference_code": "123"
1
+ {
2
+ "data": {
3
+ "escrow_list": [
4
+ {
5
+ "data": {
6
+ "created_at": "2013-06-20T15:23:01.61",
7
+ "buyer_username": "alice",
8
+ "reference_code": "123"
9
+ },
10
+ "actions": {
11
+ "release_url": "/api/escrow_release/1/"
12
+ }
8
13
  },
9
- "actions": {
10
- "release_url": "/api/escrow_release/1/"
14
+ {
15
+ "data": {
16
+ "created_at": "2013-06-21T16:20:13.04",
17
+ "buyer_username": "bob",
18
+ "reference_code": "456"
19
+ },
20
+ "actions": {
21
+ "release_url": "/api/escrow_release/2/"
22
+ }
11
23
  }
12
- },
13
- {
14
- "data": {
15
- "created_at": "2013-06-21T16:20:13.04",
16
- "buyer_username": "bob",
17
- "reference_code": "456"
18
- },
19
- "actions": {
20
- "release_url": "/api/escrow_release/2/"
21
- }
22
- }
23
- ]
24
- }
24
+ ]
25
+ }
26
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "data":{
3
+ "ad_list":[
4
+ {
5
+ "data":{
6
+ "require_feedback_score":90,
7
+ "reference_type":"SHORT",
8
+ "trusted_required":false,
9
+ "currency":"CDF",
10
+ "age_days_coefficient_limit":"4.00",
11
+ "first_time_limit_btc":"0.50",
12
+ "city":"Dubai",
13
+ "location_string":"Dubai, UAE",
14
+ "countrycode":"AE",
15
+ "max_amount":"9895",
16
+ "lon":-105.23,
17
+ "sms_verification_required":true,
18
+ "require_trade_volume":0.00,
19
+ "online_provider":"NATIONAL_BANK",
20
+ "max_amount_available":"9895",
21
+ "msg":"Contact hours: 12:00-24:00\r\n\r\nMeeting preferences: McDonalds only\r\n\r\nNot really hoping to sell any congolese francs in dubai, just checking market size here.\r\n",
22
+ "email":"bobthebuilder@email.com",
23
+ "volume_coefficient_btc":"1.50",
24
+ "profile":{
25
+ "username":"bob",
26
+ "feedback_score":100,
27
+ "trade_count":"1",
28
+ "last_online":"2014-06-19T21:07:22+00:00",
29
+ "name":"bob (1; 100%)"
30
+ },
31
+ "bank_name":"",
32
+ "trade_type":"LOCAL_SELL",
33
+ "ad_id":123456,
34
+ "temp_price":"99999999.01",
35
+ "min_amount":"1",
36
+ "temp_price_usd":"12309531",
37
+ "lat":130,
38
+ "distance":0,
39
+ "visible":true,
40
+ "created_at":"2014-06-18T18:07:06+00:00",
41
+ "atm_model":null
42
+ },
43
+ "actions":{
44
+ "public_view":"https://localbitcoins.com/ad/123456"
45
+ }
46
+ },
47
+ {
48
+ "data":{
49
+ "require_feedback_score":0,
50
+ "reference_type":"SHORT",
51
+ "trusted_required":false,
52
+ "currency":"CDF",
53
+ "age_days_coefficient_limit":"4.00",
54
+ "first_time_limit_btc":null,
55
+ "city":"Cuernavaca",
56
+ "location_string":"Dubai, UAE",
57
+ "countrycode":"AE",
58
+ "max_amount":"5000",
59
+ "lon":-40.23,
60
+ "sms_verification_required":true,
61
+ "require_trade_volume":0.00,
62
+ "online_provider":"NATIONAL_BANK",
63
+ "max_amount_available":"5000",
64
+ "msg":"Fell in a hole and found a secret and magical world! Bitcoins grow on trees down here ;)",
65
+ "email":"alice@wonderland.com",
66
+ "volume_coefficient_btc":"1.50",
67
+ "profile":{
68
+ "username":"alice",
69
+ "feedback_score":100,
70
+ "trade_count":"30+",
71
+ "last_online":"2014-06-20T20:07:58+00:00",
72
+ "name":"alice (30+; 100%)"
73
+ },
74
+ "bank_name":"",
75
+ "trade_type":"LOCAL_SELL",
76
+ "ad_id":67890,
77
+ "temp_price":"8200.51",
78
+ "min_amount":"500",
79
+ "temp_price_usd":"631.16",
80
+ "lat":40.92,
81
+ "distance":617.01,
82
+ "visible":true,
83
+ "created_at":"2014-01-09T18:12:22+00:00",
84
+ "atm_model":null
85
+ },
86
+ "actions":{
87
+ "public_view":"https://localbitcoins.com/ad/67890"
88
+ }
89
+ }
90
+ ],
91
+ "ad_count":2
92
+ }
93
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "data":{
3
+ "ad_list":[
4
+ {
5
+ "data":{
6
+ "require_feedback_score":0,
7
+ "reference_type":"SHORT",
8
+ "trusted_required":false,
9
+ "currency":"USD",
10
+ "age_days_coefficient_limit":"4.00",
11
+ "first_time_limit_btc":null,
12
+ "city":"Guadalajara",
13
+ "location_string":"Guadalajara, JAL, Mexico",
14
+ "countrycode":"MX",
15
+ "max_amount":"20",
16
+ "lon":-40.35,
17
+ "sms_verification_required":false,
18
+ "require_trade_volume":0.00,
19
+ "online_provider":"NATIONAL_BANK",
20
+ "max_amount_available":"80",
21
+ "msg":"Hello world!",
22
+ "email":null,
23
+ "volume_coefficient_btc":"1.50",
24
+ "profile":{
25
+ "username":"bobby",
26
+ "feedback_score":100,
27
+ "trade_count":"0",
28
+ "last_online":"2014-06-19T05:10:44+00:00",
29
+ "name":"bobby (0)"
30
+ },
31
+ "bank_name":"",
32
+ "trade_type":"LOCAL_BUY",
33
+ "ad_id":12345,
34
+ "temp_price":"594.83",
35
+ "min_amount":"5",
36
+ "temp_price_usd":"594.83",
37
+ "lat":20.66,
38
+ "distance":187.06,
39
+ "visible":true,
40
+ "created_at":"2014-04-02T05:07:01+00:00",
41
+ "atm_model":null
42
+ },
43
+ "actions":{
44
+ "public_view":"https://localbitcoins.com/ad/12345"
45
+ }
46
+ },
47
+ {
48
+ "data":{
49
+ "require_feedback_score":0,
50
+ "reference_type":"SHORT",
51
+ "trusted_required":false,
52
+ "currency":"MXN",
53
+ "age_days_coefficient_limit":"4.00",
54
+ "first_time_limit_btc":null,
55
+ "city":"San Luis Potosi",
56
+ "location_string":"San Luis Potosi, Mexico",
57
+ "countrycode":"MX",
58
+ "max_amount":"1500",
59
+ "lon":-100.99,
60
+ "sms_verification_required":true,
61
+ "require_trade_volume":0.00,
62
+ "online_provider":"NATIONAL_BANK",
63
+ "max_amount_available":"1500",
64
+ "msg":"Hola, mundo!",
65
+ "email":null,
66
+ "volume_coefficient_btc":"1.50",
67
+ "profile":{
68
+ "username":"alicia",
69
+ "feedback_score":100,
70
+ "trade_count":"30+",
71
+ "last_online":"2014-06-20T20:04:58+00:00",
72
+ "name":"alicia (30+; 100%)"
73
+ },
74
+ "bank_name":"",
75
+ "trade_type":"LOCAL_BUY",
76
+ "ad_id":67890,
77
+ "temp_price":"7181.61",
78
+ "min_amount":"100",
79
+ "temp_price_usd":"593.52",
80
+ "lat":40.26,
81
+ "distance":480.57,
82
+ "visible":true,
83
+ "created_at":"2013-11-22T05:36:08+00:00",
84
+ "atm_model":null
85
+ },
86
+ "actions":{
87
+ "public_view":"https://localbitcoins.com/ad/67890"
88
+ }
89
+ }
90
+ ],
91
+ "ad_count":2
92
+ }
93
+ }
File without changes
@@ -0,0 +1,14 @@
1
+ {
2
+ "data": {
3
+ "username": "alice",
4
+ "trading_partners_count": 25,
5
+ "feedbacks_unconfirmed_count": 1,
6
+ "trade_volume_text": "Less than 25 BTC",
7
+ "has_common_trades": false,
8
+ "confirmed_trade_count_text": "40",
9
+ "blocked_count": 0,
10
+ "feedback_count": 2,
11
+ "url": "https://localbitcoins.com/p/alice/",
12
+ "trusted_count": 4
13
+ }
14
+ }