checkout_ru 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/checkout_ru.rb +1 -1
- data/lib/checkout_ru/session.rb +50 -21
- data/lib/checkout_ru/version.rb +1 -1
- data/test/checkout_ru/session_test.rb +1 -1
- data/test/checkout_ru_test.rb +17 -18
- data/test/fixtures/calculation.yml +994 -1142
- data/test/fixtures/create_order.yml +8 -7
- data/test/fixtures/get_place_by_postal_code.yml +21 -274
- data/test/fixtures/get_places_by_query.yml +18 -376
- data/test/fixtures/get_postal_code_by_address.yml +21 -274
- data/test/fixtures/get_streets_by_query.yml +18 -64
- data/test/fixtures/get_ticket.yml +8 -7
- data/test/fixtures/get_ticket_invalid_api_key.yml +7 -7
- data/test/fixtures/populated_status_history.yml +23 -50
- data/test/fixtures/status.yml +12 -11
- data/test/fixtures/status_history.yml +15 -14
- data/test/fixtures/update_order.yml +16 -14
- metadata +3 -3
@@ -17,18 +17,19 @@ http_interactions:
|
|
17
17
|
message:
|
18
18
|
headers:
|
19
19
|
server:
|
20
|
-
- nginx/1.7.
|
20
|
+
- nginx/1.7.7
|
21
21
|
date:
|
22
|
-
-
|
22
|
+
- Wed, 21 Jan 2015 15:02:39 GMT
|
23
23
|
content-type:
|
24
24
|
- application/json;charset=UTF-8
|
25
|
-
|
26
|
-
-
|
25
|
+
content-length:
|
26
|
+
- '113'
|
27
27
|
connection:
|
28
28
|
- close
|
29
29
|
body:
|
30
30
|
encoding: UTF-8
|
31
|
-
string: '{"ticket":"
|
31
|
+
string: '{"ticket":"d18972a7f5aa57bf5133cba774413896", "receiverEmailNotRequired":"false",
|
32
|
+
"isCashOnDeliveryOnly":"false"}'
|
32
33
|
http_version:
|
33
|
-
recorded_at:
|
34
|
-
recorded_with: VCR 2.
|
34
|
+
recorded_at: Wed, 21 Jan 2015 15:02:39 GMT
|
35
|
+
recorded_with: VCR 2.9.3
|
@@ -13,22 +13,22 @@ http_interactions:
|
|
13
13
|
- application/json
|
14
14
|
response:
|
15
15
|
status:
|
16
|
-
code:
|
16
|
+
code: 200
|
17
17
|
message:
|
18
18
|
headers:
|
19
19
|
server:
|
20
|
-
- nginx/1.7.
|
20
|
+
- nginx/1.7.7
|
21
21
|
date:
|
22
|
-
-
|
22
|
+
- Wed, 21 Jan 2015 15:02:40 GMT
|
23
23
|
content-type:
|
24
|
-
-
|
24
|
+
- application/json;charset=UTF-8
|
25
25
|
transfer-encoding:
|
26
26
|
- chunked
|
27
27
|
connection:
|
28
28
|
- close
|
29
29
|
body:
|
30
30
|
encoding: UTF-8
|
31
|
-
string: "
|
31
|
+
string: '{"error":true,"errorCode":3,"errorMessage":"Invalid apiKey"}'
|
32
32
|
http_version:
|
33
|
-
recorded_at:
|
34
|
-
recorded_with: VCR 2.
|
33
|
+
recorded_at: Wed, 21 Jan 2015 15:02:40 GMT
|
34
|
+
recorded_with: VCR 2.9.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://platform.checkout.ru/service/order/statushistory/
|
5
|
+
uri: http://platform.checkout.ru/service/order/statushistory/44391?apiKey=valid-api-key
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -14,57 +14,30 @@ http_interactions:
|
|
14
14
|
response:
|
15
15
|
status:
|
16
16
|
code: 200
|
17
|
-
message:
|
17
|
+
message:
|
18
18
|
headers:
|
19
|
-
date:
|
20
|
-
- Sat, 01 Feb 2014 20:58:07 GMT
|
21
19
|
server:
|
22
|
-
-
|
23
|
-
|
24
|
-
-
|
25
|
-
transfer-encoding:
|
26
|
-
- chunked
|
20
|
+
- nginx/1.7.7
|
21
|
+
date:
|
22
|
+
- Wed, 21 Jan 2015 15:02:40 GMT
|
27
23
|
content-type:
|
28
24
|
- application/json;charset=UTF-8
|
25
|
+
content-length:
|
26
|
+
- '894'
|
27
|
+
connection:
|
28
|
+
- close
|
29
29
|
body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QtNGD0LPQvtGA0L7QtNC90LXQuSDRgdC1
|
58
|
-
0YLQuCBEUEQiLAoiZGF0ZSI6IjExLjA5LjIwMTMgMTE6MjA6NDYiCn0sCgp7
|
59
|
-
CiJzdGF0dXMiOiLQn9C+0YHRi9C70LrQsCDQvdCw0YXQvtC00LjRgtGB0Y8g
|
60
|
-
0L3QsCDRgtC10YDQvNC40L3QsNC70LUgRFBELCDQutC+0YLQvtGA0YvQuSDQ
|
61
|
-
vtGB0YPRidC10YHRgtCy0LvRj9C10YIg0LXRkSDQtNC+0YHRgtCw0LLQutGD
|
62
|
-
INC/0L7Qu9GD0YfQsNGC0LXQu9GOIiwKImRhdGUiOiIxMi4wOS4yMDEzIDEy
|
63
|
-
OjI3OjEwIgp9LAoKewoic3RhdHVzIjoi0J/QvtGB0YvQu9C60LAg0LTQvtGB
|
64
|
-
0YLQsNCy0LvRj9C10YLRgdGPINC/0L7Qu9GD0YfQsNGC0LXQu9GOIiwKImRh
|
65
|
-
dGUiOiIxMi4wOS4yMDEzIDE3OjIxOjI4Igp9LAoKewoic3RhdHVzIjoi0J/Q
|
66
|
-
vtGB0YvQu9C60LAg0LTQvtGB0YLQsNCy0LvQtdC90LAiLAoiZGF0ZSI6IjE2
|
67
|
-
LjA5LjIwMTMgMTQ6MTA6MDAiCn0KCl0KfQ==
|
68
|
-
http_version:
|
69
|
-
recorded_at: Sat, 01 Feb 2014 20:59:19 GMT
|
70
|
-
recorded_with: VCR 2.8.0
|
30
|
+
encoding: UTF-8
|
31
|
+
string: "{\n\"order\":{\n\"id\":\"33195\", \n\"date\":\"7.10.2014\", \n\"totalCost\":1320.0,
|
32
|
+
\n\"approximateDeliveryDate\":null},\"user\":{\n\"fullname\":\"Ольга Суржик\",
|
33
|
+
\n\"address\":{\n\"postindex\":\"173015\", \n\"place\":\"г. Великий Новгород
|
34
|
+
(Новгородская область)\",\n\"street\":\"ул. Псковская\",\n\"house\":\"40\",
|
35
|
+
\n\"housing\":\"\", \n\"building\":\"2\", \n\"appartment\":\"7\"}},\"deliveryName\":\"SPSR\",
|
36
|
+
\"deliveryHistory\" : [\n\n{\n\"status\":\"Москва - Хранилище неперерегистрированного\",\n\"date\":\"07.10.2014
|
37
|
+
17:01:00\"\n},\n\n{\n\"status\":\"Подтвержден\",\n\"date\":\"07.10.2014 19:15:48\"\n},\n\n{\n\"status\":\"Заказ
|
38
|
+
прибыл от отправителя в СД и находится на терминале отправления\",\n\"date\":\"08.10.2014
|
39
|
+
17:06:00\"\n},\n\n{\n\"status\":\"Заказ получен покупателем\",\n\"date\":\"16.10.2014
|
40
|
+
16:25:00\"\n}\n\n]\n}"
|
41
|
+
http_version:
|
42
|
+
recorded_at: Wed, 21 Jan 2015 15:02:40 GMT
|
43
|
+
recorded_with: VCR 2.9.3
|
data/test/fixtures/status.yml
CHANGED
@@ -6,8 +6,9 @@ http_interactions:
|
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: '{"order":{"goods":[{"name":"blue tshirt","code":"blt","variantCode":"blue","quantity":2,"assessedCost":1000,"payCost":750,"weight":0.5}],"delivery":{"deliveryId":2,"placeFiasId":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","addressPvz":"1-я
|
9
|
-
Квесисская улица, 18","type":"postamat","cost":
|
10
|
-
Order","email":"testorder@example.com","phone":"
|
9
|
+
Квесисская улица, 18","type":"postamat","cost":250,"minTerm":1,"maxTerm":2},"user":{"fullname":"Test
|
10
|
+
Order","email":"testorder@example.com","phone":"+79876543210"},"comment":"TEST
|
11
|
+
ORDER","paymentMethod":"cash"},"apiKey":"valid-api-key"}'
|
11
12
|
headers:
|
12
13
|
User-Agent:
|
13
14
|
- Faraday v0.8.9
|
@@ -21,9 +22,9 @@ http_interactions:
|
|
21
22
|
message:
|
22
23
|
headers:
|
23
24
|
server:
|
24
|
-
- nginx/1.7.
|
25
|
+
- nginx/1.7.7
|
25
26
|
date:
|
26
|
-
-
|
27
|
+
- Wed, 21 Jan 2015 15:02:41 GMT
|
27
28
|
content-type:
|
28
29
|
- application/json;charset=UTF-8
|
29
30
|
transfer-encoding:
|
@@ -32,12 +33,12 @@ http_interactions:
|
|
32
33
|
- close
|
33
34
|
body:
|
34
35
|
encoding: UTF-8
|
35
|
-
string: '{"order":{"id":
|
36
|
+
string: '{"order":{"id":90121},"delivery":{"id":2,"serviceName":"PickPoint","cost":"250.0"}}'
|
36
37
|
http_version:
|
37
|
-
recorded_at:
|
38
|
+
recorded_at: Wed, 21 Jan 2015 15:02:41 GMT
|
38
39
|
- request:
|
39
40
|
method: post
|
40
|
-
uri: http://platform.checkout.ru/service/order/status/
|
41
|
+
uri: http://platform.checkout.ru/service/order/status/90121
|
41
42
|
body:
|
42
43
|
encoding: UTF-8
|
43
44
|
string: '{"status":"CANCELLED_BEFORE_SHIPMENT","apiKey":"valid-api-key"}'
|
@@ -54,9 +55,9 @@ http_interactions:
|
|
54
55
|
message:
|
55
56
|
headers:
|
56
57
|
server:
|
57
|
-
- nginx/1.7.
|
58
|
+
- nginx/1.7.7
|
58
59
|
date:
|
59
|
-
-
|
60
|
+
- Wed, 21 Jan 2015 15:02:41 GMT
|
60
61
|
transfer-encoding:
|
61
62
|
- chunked
|
62
63
|
connection:
|
@@ -65,5 +66,5 @@ http_interactions:
|
|
65
66
|
encoding: UTF-8
|
66
67
|
string: ''
|
67
68
|
http_version:
|
68
|
-
recorded_at:
|
69
|
-
recorded_with: VCR 2.
|
69
|
+
recorded_at: Wed, 21 Jan 2015 15:02:41 GMT
|
70
|
+
recorded_with: VCR 2.9.3
|
@@ -6,8 +6,9 @@ http_interactions:
|
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: '{"order":{"goods":[{"name":"blue tshirt","code":"blt","variantCode":"blue","quantity":2,"assessedCost":1000,"payCost":750,"weight":0.5}],"delivery":{"deliveryId":2,"placeFiasId":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","addressPvz":"1-я
|
9
|
-
Квесисская улица, 18","type":"postamat","cost":
|
10
|
-
Order","email":"testorder@example.com","phone":"
|
9
|
+
Квесисская улица, 18","type":"postamat","cost":250,"minTerm":1,"maxTerm":2},"user":{"fullname":"Test
|
10
|
+
Order","email":"testorder@example.com","phone":"+79876543210"},"comment":"TEST
|
11
|
+
ORDER","paymentMethod":"cash"},"apiKey":"valid-api-key"}'
|
11
12
|
headers:
|
12
13
|
User-Agent:
|
13
14
|
- Faraday v0.8.9
|
@@ -21,9 +22,9 @@ http_interactions:
|
|
21
22
|
message:
|
22
23
|
headers:
|
23
24
|
server:
|
24
|
-
- nginx/1.7.
|
25
|
+
- nginx/1.7.7
|
25
26
|
date:
|
26
|
-
-
|
27
|
+
- Wed, 21 Jan 2015 15:02:40 GMT
|
27
28
|
content-type:
|
28
29
|
- application/json;charset=UTF-8
|
29
30
|
transfer-encoding:
|
@@ -32,12 +33,12 @@ http_interactions:
|
|
32
33
|
- close
|
33
34
|
body:
|
34
35
|
encoding: UTF-8
|
35
|
-
string: '{"order":{"id":
|
36
|
+
string: '{"order":{"id":90119},"delivery":{"id":2,"serviceName":"PickPoint","cost":"250.0"}}'
|
36
37
|
http_version:
|
37
|
-
recorded_at:
|
38
|
+
recorded_at: Wed, 21 Jan 2015 15:02:40 GMT
|
38
39
|
- request:
|
39
40
|
method: get
|
40
|
-
uri: http://platform.checkout.ru/service/order/statushistory/
|
41
|
+
uri: http://platform.checkout.ru/service/order/statushistory/90119?apiKey=valid-api-key
|
41
42
|
body:
|
42
43
|
encoding: US-ASCII
|
43
44
|
string: ''
|
@@ -52,22 +53,22 @@ http_interactions:
|
|
52
53
|
message:
|
53
54
|
headers:
|
54
55
|
server:
|
55
|
-
- nginx/1.7.
|
56
|
+
- nginx/1.7.7
|
56
57
|
date:
|
57
|
-
-
|
58
|
+
- Wed, 21 Jan 2015 15:02:40 GMT
|
58
59
|
content-type:
|
59
60
|
- application/json;charset=UTF-8
|
60
|
-
|
61
|
-
-
|
61
|
+
content-length:
|
62
|
+
- '333'
|
62
63
|
connection:
|
63
64
|
- close
|
64
65
|
body:
|
65
66
|
encoding: UTF-8
|
66
|
-
string: "{\n\"order\":{\n\"id\":\"
|
67
|
+
string: "{\n\"order\":{\n\"id\":\"90119\", \n\"date\":\"21.01.2015\", \n\"totalCost\":1750.0,
|
67
68
|
\n\"approximateDeliveryDate\":null},\"user\":{\n\"fullname\":\"Test Order\",
|
68
69
|
\n\"address\":{\n\"postindex\":null, \n\"place\":\"г. Москва\",\n\"street\":\"\",\n\"house\":null,
|
69
70
|
\n\"housing\":null, \n\"building\":null, \n\"appartment\":null}},\"deliveryName\":\"PickPoint\",
|
70
71
|
\"deliveryHistory\" : [\n\n]\n}"
|
71
72
|
http_version:
|
72
|
-
recorded_at:
|
73
|
-
recorded_with: VCR 2.
|
73
|
+
recorded_at: Wed, 21 Jan 2015 15:02:40 GMT
|
74
|
+
recorded_with: VCR 2.9.3
|
@@ -6,8 +6,9 @@ http_interactions:
|
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: '{"order":{"goods":[{"name":"blue tshirt","code":"blt","variantCode":"blue","quantity":2,"assessedCost":1000,"payCost":750,"weight":0.5}],"delivery":{"deliveryId":2,"placeFiasId":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","addressPvz":"1-я
|
9
|
-
Квесисская улица, 18","type":"postamat","cost":
|
10
|
-
|
9
|
+
Квесисская улица, 18","type":"postamat","cost":250,"minTerm":1,"maxTerm":2},"user":{"fullname":"Test
|
10
|
+
Order","email":"testorder@example.com","phone":"+79876543210"},"comment":"TEST
|
11
|
+
ORDER","paymentMethod":"cash"},"apiKey":"valid-api-key"}'
|
11
12
|
headers:
|
12
13
|
User-Agent:
|
13
14
|
- Faraday v0.8.9
|
@@ -21,9 +22,9 @@ http_interactions:
|
|
21
22
|
message:
|
22
23
|
headers:
|
23
24
|
server:
|
24
|
-
- nginx/1.7.
|
25
|
+
- nginx/1.7.7
|
25
26
|
date:
|
26
|
-
-
|
27
|
+
- Wed, 21 Jan 2015 15:02:42 GMT
|
27
28
|
content-type:
|
28
29
|
- application/json;charset=UTF-8
|
29
30
|
transfer-encoding:
|
@@ -32,17 +33,18 @@ http_interactions:
|
|
32
33
|
- close
|
33
34
|
body:
|
34
35
|
encoding: UTF-8
|
35
|
-
string: '{"order":{"id":
|
36
|
+
string: '{"order":{"id":90123},"delivery":{"id":2,"serviceName":"PickPoint","cost":"250.0"}}'
|
36
37
|
http_version:
|
37
|
-
recorded_at:
|
38
|
+
recorded_at: Wed, 21 Jan 2015 15:02:42 GMT
|
38
39
|
- request:
|
39
40
|
method: post
|
40
|
-
uri: http://platform.checkout.ru/service/order/
|
41
|
+
uri: http://platform.checkout.ru/service/order/90123
|
41
42
|
body:
|
42
43
|
encoding: UTF-8
|
43
44
|
string: '{"order":{"goods":[{"name":"blue tshirt","code":"blt","variantCode":"blue","quantity":2,"assessedCost":1000,"payCost":750,"weight":0.5}],"delivery":{"deliveryId":2,"placeFiasId":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","addressPvz":"1-я
|
44
|
-
Квесисская улица, 18","type":"postamat","cost":
|
45
|
-
Пупкин","email":"
|
45
|
+
Квесисская улица, 18","type":"postamat","cost":250,"minTerm":1,"maxTerm":2},"user":{"fullname":"Петя
|
46
|
+
Пупкин","email":"testorder@example.com","phone":"+79876543210"},"comment":"TEST
|
47
|
+
ORDER","paymentMethod":"cash"},"apiKey":"valid-api-key"}'
|
46
48
|
headers:
|
47
49
|
User-Agent:
|
48
50
|
- Faraday v0.8.9
|
@@ -56,9 +58,9 @@ http_interactions:
|
|
56
58
|
message:
|
57
59
|
headers:
|
58
60
|
server:
|
59
|
-
- nginx/1.7.
|
61
|
+
- nginx/1.7.7
|
60
62
|
date:
|
61
|
-
-
|
63
|
+
- Wed, 21 Jan 2015 15:02:43 GMT
|
62
64
|
content-type:
|
63
65
|
- application/json;charset=UTF-8
|
64
66
|
transfer-encoding:
|
@@ -67,7 +69,7 @@ http_interactions:
|
|
67
69
|
- close
|
68
70
|
body:
|
69
71
|
encoding: UTF-8
|
70
|
-
string: '{"order":{"id":
|
72
|
+
string: '{"order":{"id":90123},"delivery":{"id":2,"serviceName":"PickPoint","cost":"250.0"}}'
|
71
73
|
http_version:
|
72
|
-
recorded_at:
|
73
|
-
recorded_with: VCR 2.
|
74
|
+
recorded_at: Wed, 21 Jan 2015 15:02:43 GMT
|
75
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkout_ru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Chernyak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
224
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.
|
225
|
+
rubygems_version: 2.2.2
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: Ruby client for checkout.ru
|