gillbus 0.16.3 → 0.16.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/gillbus/return_position.rb +42 -0
- data/lib/gillbus/version.rb +1 -1
- data/lib/gillbus.rb +1 -1
- data/test/responses/returnPositionFailure.xml +9 -0
- data/test/responses/returnPositionSuccess.xml +9 -0
- data/test/return_position_test.rb +33 -0
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a9b2fd21aa6fc463949bba2bd5e33aaae545ce5
|
4
|
+
data.tar.gz: 611957d82e6a4f72cd2aff6dc82da804c3bcd8e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fed5630ff9ae4bac56a93a19c8469b2e32dba9a46ff737f672c55564c58be89807918e07cff2bb0a6209482c69e861e2bd37f58770c45a4e3df6cb372e6be9f4
|
7
|
+
data.tar.gz: 551094e43187b12b34035c691d90d0df2e6d5fae537cab1de7e9be2e56bfeae08e2c82fa2841be1f9cdf580b0890e45a4fed18e355564a0b1217f925129959d1
|
data/LICENSE.txt
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
class Gillbus
|
2
|
+
module ReturnPosition
|
3
|
+
Gillbus.register self, :return_position
|
4
|
+
|
5
|
+
class Request < BaseRequest
|
6
|
+
|
7
|
+
def path; '/online2/returnPosition' end
|
8
|
+
|
9
|
+
# ticketCount
|
10
|
+
# Кол-во возвращаемых билетов. 1..k
|
11
|
+
attr_accessor :ticket_count
|
12
|
+
|
13
|
+
# Номера билетов с порядковым номером
|
14
|
+
attr_accessor :system_numbers
|
15
|
+
|
16
|
+
def params
|
17
|
+
numbers = system_numbers.map.with_index do |num, i|
|
18
|
+
[:"systemNumber#{i}", num]
|
19
|
+
end.to_h
|
20
|
+
|
21
|
+
compact(
|
22
|
+
ticketCount: ticket_count,
|
23
|
+
**numbers,
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Response < BaseResponse
|
29
|
+
class ReturnPosition
|
30
|
+
extend Fields
|
31
|
+
|
32
|
+
field :system_number
|
33
|
+
field :confirmation, :yesno_bool
|
34
|
+
field :reason_id
|
35
|
+
field :date
|
36
|
+
field :failures
|
37
|
+
end
|
38
|
+
|
39
|
+
field :return_positions, [ReturnPosition], key: 'RETURN_POSITION'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/gillbus/version.rb
CHANGED
data/lib/gillbus.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class ReturnPositionTest < Minitest::Test
|
4
|
+
def test_request
|
5
|
+
request = Gillbus::ReturnPosition::Request.new(
|
6
|
+
ticket_count: 1,
|
7
|
+
system_numbers: [123456],
|
8
|
+
)
|
9
|
+
|
10
|
+
assert_equal({
|
11
|
+
ticketCount: 1,
|
12
|
+
systemNumber0: 123456,
|
13
|
+
}, request.params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_success_response
|
17
|
+
assert success_response.return_positions.first.confirmation
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_failure_response
|
21
|
+
refute failure_response.return_positions.first.confirmation
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def success_response
|
27
|
+
Gillbus::ReturnPosition::Response.parse_string(File.read('test/responses/returnPositionSuccess.xml'))
|
28
|
+
end
|
29
|
+
|
30
|
+
def failure_response
|
31
|
+
Gillbus::ReturnPosition::Response.parse_string(File.read('test/responses/returnPositionFailure.xml'))
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gillbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey "codesnik" Trofimenko
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-11-
|
12
|
+
date: 2017-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_xml
|
@@ -180,6 +180,7 @@ files:
|
|
180
180
|
- lib/gillbus/logout.rb
|
181
181
|
- lib/gillbus/parse_error.rb
|
182
182
|
- lib/gillbus/reserve_tickets.rb
|
183
|
+
- lib/gillbus/return_position.rb
|
183
184
|
- lib/gillbus/search_trips.rb
|
184
185
|
- lib/gillbus/session_login.rb
|
185
186
|
- lib/gillbus/structs/commission.rb
|
@@ -238,6 +239,8 @@ files:
|
|
238
239
|
- test/responses/getTripSegments.xml
|
239
240
|
- test/responses/lockSeats.xml
|
240
241
|
- test/responses/reserveTickets.xml
|
242
|
+
- test/responses/returnPositionFailure.xml
|
243
|
+
- test/responses/returnPositionSuccess.xml
|
241
244
|
- test/responses/searchTrips-empty.xml
|
242
245
|
- test/responses/searchTrips-prod-invalid.xml
|
243
246
|
- test/responses/searchTrips-prod.xml
|
@@ -247,6 +250,7 @@ files:
|
|
247
250
|
- test/responses/ticketsBooking.xml
|
248
251
|
- test/responses/ticketsBookingAllCommissions.xml
|
249
252
|
- test/responses/very_empty.xml
|
253
|
+
- test/return_position_test.rb
|
250
254
|
- test/search_trips_test.rb
|
251
255
|
- test/session_login_test.rb
|
252
256
|
- test/test_helper.rb
|
@@ -309,6 +313,8 @@ test_files:
|
|
309
313
|
- test/responses/getTripSegments.xml
|
310
314
|
- test/responses/lockSeats.xml
|
311
315
|
- test/responses/reserveTickets.xml
|
316
|
+
- test/responses/returnPositionFailure.xml
|
317
|
+
- test/responses/returnPositionSuccess.xml
|
312
318
|
- test/responses/searchTrips-empty.xml
|
313
319
|
- test/responses/searchTrips-prod-invalid.xml
|
314
320
|
- test/responses/searchTrips-prod.xml
|
@@ -318,8 +324,8 @@ test_files:
|
|
318
324
|
- test/responses/ticketsBooking.xml
|
319
325
|
- test/responses/ticketsBookingAllCommissions.xml
|
320
326
|
- test/responses/very_empty.xml
|
327
|
+
- test/return_position_test.rb
|
321
328
|
- test/search_trips_test.rb
|
322
329
|
- test/session_login_test.rb
|
323
330
|
- test/test_helper.rb
|
324
331
|
- test/tickets_booking_test.rb
|
325
|
-
has_rdoc:
|