recras 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/recras.rb +4 -1
- data/lib/recras/booking.rb +18 -0
- data/lib/recras/client.rb +11 -0
- data/lib/recras/combination.rb +3 -2
- data/lib/recras/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5becc83f4d161b4ffbeecec0a38579194a145685
|
4
|
+
data.tar.gz: 3016eb759a7375f713c8ec3766c09789452f2335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4608a7f30d5fcfbc30c53b7988f6b6593803245f95246e7641ef28c7f65c42adbfb62d82a2617fb2bfbd7351d0f6b81644958f0350d185bedfe953a06c50d448
|
7
|
+
data.tar.gz: a403601e39796f2743cb6ffefb18e9eda507f01c23c2e7cf71348ab9a26efef6f3a7176a1a4116aa5d64ed86d05c0835df7a2906cb8352ff0f76bdb8a4043ef6
|
data/README.md
CHANGED
@@ -36,6 +36,10 @@ To request two barcodes from two different ticket kinds (4 barcodes in total), y
|
|
36
36
|
|
37
37
|
```
|
38
38
|
|
39
|
+
### PaymentMethod
|
40
|
+
Obtain a list of payment methods: `@recras_client.payment_methods`
|
41
|
+
|
42
|
+
|
39
43
|
### Combinations
|
40
44
|
The Recras system bundles different products together in 'combinations'. Their API uses the term 'arrangementen' for it.
|
41
45
|
|
data/lib/recras.rb
CHANGED
@@ -14,6 +14,9 @@ require "recras/combination_item"
|
|
14
14
|
require "recras/contact_form"
|
15
15
|
require "recras/contact_form_field"
|
16
16
|
require "recras/booking"
|
17
|
+
require "recras/invoice"
|
18
|
+
require "recras/payment_method"
|
19
|
+
require "recras/payment"
|
17
20
|
require "recras/itinerary"
|
18
21
|
|
19
22
|
module Recras
|
@@ -28,7 +31,7 @@ module Recras
|
|
28
31
|
# this method maps the recras API objects to
|
29
32
|
# the names used by this gem
|
30
33
|
def self.object_mappings
|
31
|
-
[["personeel", Person], ["arrangement", Combination], ["contactformulier", ContactForm], ["velden", ContactFormField], ["booking", Booking]]
|
34
|
+
[["betalingen", Payment],["personeel", Person], ["arrangement", Combination], ["contactformulier", ContactForm], ["velden", ContactFormField], ["booking", Booking], ["facturen", Invoice], ["betaalmethoden", PaymentMethod]]
|
32
35
|
end
|
33
36
|
|
34
37
|
def self.url
|
data/lib/recras/booking.rb
CHANGED
@@ -11,6 +11,7 @@ module Recras
|
|
11
11
|
attr_accessor :message
|
12
12
|
attr_accessor :customer_id
|
13
13
|
attr_accessor :payment_url
|
14
|
+
attr_accessor :client
|
14
15
|
|
15
16
|
# Initializer to transform a +Hash+ into an Client object
|
16
17
|
# @param [Hash] args
|
@@ -35,5 +36,22 @@ module Recras
|
|
35
36
|
]
|
36
37
|
end
|
37
38
|
|
39
|
+
def make_invoice(status: 'concept')
|
40
|
+
|
41
|
+
body_data = {
|
42
|
+
boeking_id: id,
|
43
|
+
status: status
|
44
|
+
}
|
45
|
+
json = client.make_request("facturen", body: body_data.to_json, http_method: :post)
|
46
|
+
if json.is_a?(Hash) && json["error"]
|
47
|
+
raise RecrasError.new(self), json["error"]["message"]
|
48
|
+
else
|
49
|
+
invoice = Recras.parse_json(json: json, endpoint: "facturen")
|
50
|
+
return invoice
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
|
38
56
|
end
|
39
57
|
end
|
data/lib/recras/client.rb
CHANGED
@@ -58,6 +58,17 @@ module Recras
|
|
58
58
|
end
|
59
59
|
|
60
60
|
|
61
|
+
# returns an array of available combinations
|
62
|
+
def payment_methods
|
63
|
+
result = make_request("betaalmethoden")
|
64
|
+
a = []
|
65
|
+
for json in result
|
66
|
+
a << Recras.parse_json(json: json, endpoint: "betaalmethoden")
|
67
|
+
end
|
68
|
+
return a
|
69
|
+
end
|
70
|
+
|
71
|
+
|
61
72
|
# returns an array of available combinations
|
62
73
|
def combinations
|
63
74
|
result = make_request("arrangementen")
|
data/lib/recras/combination.rb
CHANGED
@@ -118,7 +118,7 @@ module Recras
|
|
118
118
|
|
119
119
|
|
120
120
|
# make a reservation for this combination
|
121
|
-
def book(items: [], number_of_people: nil, date: nil, payment_method: "factuur", status: "reservering", contact_form_details: {})
|
121
|
+
def book(items: [], marked_as_paid: false, number_of_people: nil, date: nil, payment_method: "factuur", status: "reservering", contact_form_details: {})
|
122
122
|
|
123
123
|
product_items = convert_items(items, number_of_people)
|
124
124
|
date = convert_date(date)
|
@@ -130,6 +130,7 @@ module Recras
|
|
130
130
|
begin: date,
|
131
131
|
status: status,
|
132
132
|
betaalmethode: payment_method,
|
133
|
+
stuur_bevestiging_email: marked_as_paid,
|
133
134
|
contactformulier: contact_form_details
|
134
135
|
}
|
135
136
|
json = client.make_request("onlineboeking/reserveer", body: body_data.to_json, http_method: :post)
|
@@ -137,7 +138,7 @@ module Recras
|
|
137
138
|
if json.is_a?(Hash) && json["error"]
|
138
139
|
raise RecrasError.new(self), json["error"]["message"]
|
139
140
|
else
|
140
|
-
booking = Recras.parse_json(json: json, endpoint: "booking")
|
141
|
+
booking = Recras.parse_json(json: json, endpoint: "booking", client: client)
|
141
142
|
return booking
|
142
143
|
end
|
143
144
|
else
|
data/lib/recras/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henk Meijer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.6.14
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Ruby binder to the Recras API
|