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,109 @@
1
+ {
2
+ "data":{
3
+ "contact_list":[
4
+ {
5
+ "data":{
6
+ "exchange_rate_updated_at":"2014-06-19T20:32:45+00:00",
7
+ "advertisement":{
8
+ "advertiser":{
9
+ "username":"namwen",
10
+ "feedback_score":100,
11
+ "trade_count":"1",
12
+ "last_online":"2014-06-20T17:43:49+00:00",
13
+ "name":"namwen (1; 100%)"
14
+ },
15
+ "trade_type":"LOCAL_SELL",
16
+ "id":104568
17
+ },
18
+ "is_buying":false,
19
+ "payment_completed_at":null,
20
+ "released_at":null,
21
+ "created_at":"2014-06-19T20:32:45+00:00",
22
+ "contact_id":800073,
23
+ "seller":{
24
+ "username":"namwen",
25
+ "feedback_score":100,
26
+ "trade_count":"1",
27
+ "last_online":"2014-06-20T17:43:49+00:00",
28
+ "name":"namwen (1; 100%)"
29
+ },
30
+ "currency":"USD",
31
+ "amount":"666.00",
32
+ "is_selling":true,
33
+ "escrowed_at":null,
34
+ "amount_btc":"0.47320000",
35
+ "reference_code":"L800073BH5C9",
36
+ "buyer":{
37
+ "username":"solman",
38
+ "feedback_score":100,
39
+ "trade_count":"1",
40
+ "last_online":"2014-06-19T21:07:22+00:00",
41
+ "name":"solman (1; 100%)"
42
+ },
43
+ "closed_at":"2014-06-19T20:34:18+00:00",
44
+ "disputed_at":null,
45
+ "funded_at":null,
46
+ "canceled_at":"2014-06-19T20:34:18+00:00"
47
+ },
48
+ "actions":{
49
+ "message_post_url":"https://localbitcoins.com/api/contact_message_post/800073/",
50
+ "advertisement_url":"https://localbitcoins.com/api/ad-get/104568/",
51
+ "messages_url":"https://localbitcoins.com/api/contact_messages/800073/",
52
+ "advertisement_public_view":"https://localbitcoins.com/ad/104568"
53
+ }
54
+ },
55
+ {
56
+ "data":{
57
+ "exchange_rate_updated_at":"2014-06-19T19:48:58+00:00",
58
+ "advertisement":{
59
+ "advertiser":{
60
+ "username":"namwen",
61
+ "feedback_score":100,
62
+ "trade_count":"1",
63
+ "last_online":"2014-06-20T17:43:49+00:00",
64
+ "name":"namwen (1; 100%)"
65
+ },
66
+ "trade_type":"LOCAL_SELL",
67
+ "id":104483
68
+ },
69
+ "is_buying":false,
70
+ "payment_completed_at":null,
71
+ "released_at":null,
72
+ "created_at":"2014-06-19T19:48:58+00:00",
73
+ "contact_id":799940,
74
+ "seller":{
75
+ "username":"namwen",
76
+ "feedback_score":100,
77
+ "trade_count":"1",
78
+ "last_online":"2014-06-20T17:43:49+00:00",
79
+ "name":"namwen (1; 100%)"
80
+ },
81
+ "currency":"MXN",
82
+ "amount":"108.46",
83
+ "is_selling":true,
84
+ "escrowed_at":null,
85
+ "amount_btc":"0.01000000",
86
+ "reference_code":"L799940BH58K",
87
+ "buyer":{
88
+ "username":"solman",
89
+ "feedback_score":100,
90
+ "trade_count":"1",
91
+ "last_online":"2014-06-19T21:07:22+00:00",
92
+ "name":"solman (1; 100%)"
93
+ },
94
+ "closed_at":"2014-06-19T19:49:10+00:00",
95
+ "disputed_at":null,
96
+ "funded_at":"2014-06-19T19:48:59+00:00",
97
+ "canceled_at":"2014-06-19T19:49:10+00:00"
98
+ },
99
+ "actions":{
100
+ "message_post_url":"https://localbitcoins.com/api/contact_message_post/799940/",
101
+ "advertisement_url":"https://localbitcoins.com/api/ad-get/104483/",
102
+ "messages_url":"https://localbitcoins.com/api/contact_messages/799940/",
103
+ "advertisement_public_view":"https://localbitcoins.com/ad/104483"
104
+ }
105
+ }
106
+ ],
107
+ "contact_count":2
108
+ }
109
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "data":{
3
+ "exchange_rate_updated_at":"2014-06-19T19:50:43+00:00",
4
+ "advertisement":{
5
+ "advertiser":{
6
+ "username":"Bob",
7
+ "feedback_score":100,
8
+ "trade_count":"30+",
9
+ "last_online":"2014-06-20T15:36:31+00:00",
10
+ "name":"Bob (30+; 100%)"
11
+ },
12
+ "trade_type":"LOCAL_SELL",
13
+ "id":1234567
14
+ },
15
+ "is_buying":false,
16
+ "payment_completed_at":null,
17
+ "released_at":null,
18
+ "created_at":"2014-06-19T19:50:43+00:00",
19
+ "contact_id":799943,
20
+ "seller":{
21
+ "username":"Bob",
22
+ "feedback_score":100,
23
+ "trade_count":"30+",
24
+ "last_online":"2014-06-20T15:36:31+00:00",
25
+ "name":"Bob (30+; 100%)"
26
+ },
27
+ "currency":"MXN",
28
+ "amount":"1.00",
29
+ "is_selling":true,
30
+ "escrowed_at":null,
31
+ "amount_btc":"0.00009350",
32
+ "reference_code":"L791246BH58N",
33
+ "buyer":{
34
+ "username":"Alice",
35
+ "feedback_score":95,
36
+ "trade_count":"10+",
37
+ "last_online":"2014-06-19T21:07:22+00:00",
38
+ "name":"Alice (10+; 95%)"
39
+ },
40
+ "closed_at":null,
41
+ "disputed_at":null,
42
+ "funded_at":"2014-06-19T19:50:43+00:00",
43
+ "canceled_at":null
44
+ },
45
+ "actions":{
46
+ "message_post_url":"https://localbitcoins.com/api/contact_message_post/12345/",
47
+ "advertisement_url":"https://localbitcoins.com/api/ad-get/1234567/",
48
+ "messages_url":"https://localbitcoins.com/api/contact_messages/12345/",
49
+ "cancel_url":"https://localbitcoins.com/api/contact_cancel/12345/",
50
+ "advertisement_public_view":"https://localbitcoins.com/ad/12345"
51
+ }
52
+ }
@@ -0,0 +1,111 @@
1
+ {
2
+ "data": {
3
+ "contact_list": [
4
+ {
5
+ "data": {
6
+ "exchange_rate_updated_at": "2014-06-19T19:50:43+00:00",
7
+ "advertisement": {
8
+ "advertiser": {
9
+ "username": "Bob",
10
+ "feedback_score": 100,
11
+ "trade_count": "30+",
12
+ "last_online": "2014-06-20T15:36:31+00:00",
13
+ "name": "Bob (30+; 100%)"
14
+ },
15
+ "trade_type": "LOCAL_SELL",
16
+ "id": 1234567
17
+ },
18
+ "is_buying": false,
19
+ "payment_completed_at": null,
20
+ "released_at": null,
21
+ "created_at": "2014-06-19T19:50:43+00:00",
22
+ "contact_id": 799943,
23
+ "seller": {
24
+ "username": "Bob",
25
+ "feedback_score": 100,
26
+ "trade_count": "30+",
27
+ "last_online": "2014-06-20T15:36:31+00:00",
28
+ "name": "Bob (30+; 100%)"
29
+ },
30
+ "currency": "MXN",
31
+ "amount": "1.00",
32
+ "is_selling": true,
33
+ "escrowed_at": null,
34
+ "amount_btc": "0.00009350",
35
+ "reference_code": "L791246BH58N",
36
+ "buyer": {
37
+ "username": "Alice",
38
+ "feedback_score": 95,
39
+ "trade_count": "10+",
40
+ "last_online": "2014-06-19T21:07:22+00:00",
41
+ "name": "Alice (10+; 95%)"
42
+ },
43
+ "closed_at": null,
44
+ "disputed_at": null,
45
+ "funded_at": "2014-06-19T19:50:43+00:00",
46
+ "canceled_at": null
47
+ },
48
+ "actions": {
49
+ "message_post_url": "https://localbitcoins.com/api/contact_message_post/12345/",
50
+ "advertisement_url": "https://localbitcoins.com/api/ad-get/1234567/",
51
+ "messages_url": "https://localbitcoins.com/api/contact_messages/12345/",
52
+ "cancel_url": "https://localbitcoins.com/api/contact_cancel/12345/",
53
+ "advertisement_public_view": "https://localbitcoins.com/ad/12345"
54
+ }
55
+ },
56
+ {
57
+ "data": {
58
+ "exchange_rate_updated_at": "2014-06-19T19:50:43+00:00",
59
+ "advertisement": {
60
+ "advertiser": {
61
+ "username": "Bob",
62
+ "feedback_score": 100,
63
+ "trade_count": "30+",
64
+ "last_online": "2014-06-20T15:36:31+00:00",
65
+ "name": "Bob (30+; 100%)"
66
+ },
67
+ "trade_type": "LOCAL_SELL",
68
+ "id": 654321
69
+ },
70
+ "is_buying": false,
71
+ "payment_completed_at": null,
72
+ "released_at": null,
73
+ "created_at": "2014-06-19T19:50:43+00:00",
74
+ "contact_id": 123456,
75
+ "seller": {
76
+ "username": "Bob",
77
+ "feedback_score": 100,
78
+ "trade_count": "30+",
79
+ "last_online": "2014-06-20T15:36:31+00:00",
80
+ "name": "Bob (30+; 100%)"
81
+ },
82
+ "currency": "MXN",
83
+ "amount": "1.00",
84
+ "is_selling": true,
85
+ "escrowed_at": null,
86
+ "amount_btc": "0.00009350",
87
+ "reference_code": "L791246BH58N",
88
+ "buyer": {
89
+ "username": "Alice",
90
+ "feedback_score": 95,
91
+ "trade_count": "10+",
92
+ "last_online": "2014-06-19T21:07:22+00:00",
93
+ "name": "Alice (10+; 95%)"
94
+ },
95
+ "closed_at": null,
96
+ "disputed_at": null,
97
+ "funded_at": "2014-06-19T19:50:43+00:00",
98
+ "canceled_at": null
99
+ },
100
+ "actions": {
101
+ "message_post_url": "https://localbitcoins.com/api/contact_message_post/012345/",
102
+ "advertisement_url": "https://localbitcoins.com/api/ad-get/654321/",
103
+ "messages_url": "https://localbitcoins.com/api/contact_messages/012345/",
104
+ "cancel_url": "https://localbitcoins.com/api/contact_cancel/012345/",
105
+ "advertisement_public_view": "https://localbitcoins.com/ad/654321"
106
+ }
107
+ }
108
+ ],
109
+ "contact_count": 2
110
+ }
111
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "data": {
3
+ "message": "OK!",
4
+ "funded": true,
5
+ "contact_id": 123456
6
+ },
7
+ "actions": {
8
+ "contact_url": "https://localbitcoins.com/api/contact_info/123456/"
9
+ }
10
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "data":{
3
+ "message_count":3,
4
+ "message_list":[
5
+ {
6
+ "msg":"Message body",
7
+ "created_at":"2014-06-19T20:35:47+00:00",
8
+ "is_admin":false,
9
+ "sender":{
10
+ "username":"Bob",
11
+ "feedback_score":100,
12
+ "trade_count":"30+",
13
+ "last_online":"2014-06-20T15:36:31+00:00",
14
+ "name":"Bob (30+; 100%)"
15
+ }
16
+ },
17
+ {
18
+ "msg":"Text of the message.",
19
+ "created_at":"2014-06-20T15:03:10+00:00",
20
+ "is_admin":false,
21
+ "sender":{
22
+ "username":"Bob",
23
+ "feedback_score":100,
24
+ "trade_count":"30+",
25
+ "last_online":"2014-06-20T15:36:31+00:00",
26
+ "name":"Bob (30+; 100%)"
27
+ }
28
+ },
29
+ {
30
+ "msg":"This is the message.",
31
+ "created_at":"2014-06-20T15:03:31+00:00",
32
+ "is_admin":false,
33
+ "sender":{
34
+ "username":"Alice",
35
+ "feedback_score":95,
36
+ "trade_count":"10+",
37
+ "last_online":"2014-06-19T21:07:22+00:00",
38
+ "name":"Alice (10+; 95%)"
39
+ }
40
+ }
41
+ ]
42
+ }
43
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "data":{
3
+ "contact_list":[
4
+ {
5
+ "data":{
6
+ "exchange_rate_updated_at":"2014-06-20T16:44:33+00:00",
7
+ "advertisement":{
8
+ "advertiser":{
9
+ "username":"Alice",
10
+ "feedback_score":95,
11
+ "trade_count":"10+",
12
+ "last_online":"2014-06-19T21:07:22+00:00",
13
+ "name":"Alice (10+; 95%)"
14
+ },
15
+ "trade_type":"LOCAL_SELL",
16
+ "id":123456
17
+ },
18
+ "is_buying":true,
19
+ "payment_completed_at":null,
20
+ "released_at":null,
21
+ "created_at":"2014-06-20T16:44:33+00:00",
22
+ "contact_id":543210,
23
+ "seller":{
24
+ "username":"Alice",
25
+ "feedback_score":95,
26
+ "trade_count":"10+",
27
+ "last_online":"2014-06-19T21:07:22+00:00",
28
+ "name":"Alice (10+; 95%)"
29
+ },
30
+ "currency":"MXN",
31
+ "amount":"60.00",
32
+ "is_selling":false,
33
+ "escrowed_at":null,
34
+ "amount_btc":"0.10000",
35
+ "reference_code":"L802876C3764",
36
+ "buyer":{
37
+ "username":"Bob",
38
+ "feedback_score":100,
39
+ "trade_count":"30+",
40
+ "last_online":"2014-06-20T15:36:31+00:00",
41
+ "name":"Bob (30+; 100%)"
42
+ },
43
+ "closed_at":null,
44
+ "disputed_at":null,
45
+ "funded_at":"2014-06-20T16:44:34+00:00",
46
+ "canceled_at":null
47
+ },
48
+ "actions":{
49
+ "message_post_url":"https://localbitcoins.com/api/contact_message_post/543210/",
50
+ "messages_url":"https://localbitcoins.com/api/contact_messages/543210/",
51
+ "mark_as_paid_url":"https://localbitcoins.com/api/contact_mark_as_paid/543210/",
52
+ "advertisement_url":"https://localbitcoins.com/api/ad-get/123456/",
53
+ "cancel_url":"https://localbitcoins.com/api/contact_cancel/543210/",
54
+ "advertisement_public_view":"https://localbitcoins.com/ad/123456"
55
+ }
56
+ }
57
+ ],
58
+ "contact_count":1
59
+ }
60
+ }