Class: Recras::Booking
- Inherits:
-
Object
- Object
- Recras::Booking
- Extended by:
- Recras
- Defined in:
- lib/recras/booking.rb
Overview
links to ‘arrangement_regels’ in the API recras.github.io/docs/endpoints/contactformulieren.html
Constant Summary
Constants included from Recras
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
- #id ⇒ Object
-
#message ⇒ Object
Returns the value of attribute message.
-
#payment_url ⇒ Object
Returns the value of attribute payment_url.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
-
.attribute_mapping ⇒ Object
translates the mapping between the Recras API and the terms used in this gem.
Instance Method Summary collapse
-
#initialize(args = nil) ⇒ Booking
constructor
Initializer to transform a
Hash
into an Client object. - #make_invoice(status: 'concept') ⇒ Object
Methods included from Recras
make_request, new_from_json, object_mappings, parse_json, url, version
Constructor Details
#initialize(args = nil) ⇒ Booking
Initializer to transform a Hash
into an Client object
18 19 20 21 22 23 24 |
# File 'lib/recras/booking.rb', line 18 def initialize(args=nil) required_args = [] return if args.nil? args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
14 15 16 |
# File 'lib/recras/booking.rb', line 14 def client @client end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
12 13 14 |
# File 'lib/recras/booking.rb', line 12 def customer_id @customer_id end |
#id ⇒ Object
The is a required parameter.
9 10 11 |
# File 'lib/recras/booking.rb', line 9 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
11 12 13 |
# File 'lib/recras/booking.rb', line 11 def end |
#payment_url ⇒ Object
Returns the value of attribute payment_url.
13 14 15 |
# File 'lib/recras/booking.rb', line 13 def payment_url @payment_url end |
#status ⇒ Object
Returns the value of attribute status.
10 11 12 |
# File 'lib/recras/booking.rb', line 10 def status @status end |
Class Method Details
.attribute_mapping ⇒ Object
translates the mapping between the Recras API and the terms used in this gem
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/recras/booking.rb', line 28 def self.attribute_mapping [ ["id", "id"], ["status", "status"], ["message", "message"], ["boeking_id", "id"], ["klant_id", "customer_id"], ["payment_url", "payment_url"] ] end |
Instance Method Details
#make_invoice(status: 'concept') ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/recras/booking.rb', line 39 def make_invoice(status: 'concept') body_data = { boeking_id: id, status: status } json = client.make_request("facturen", body: body_data.to_json, http_method: :post) if json.is_a?(Hash) && json["error"] raise RecrasError.new(self), json["error"]["message"] else invoice = Recras.parse_json(json: json, endpoint: "facturen") return invoice end end |