Module: Mobilepay::Client::Reservations

Included in:
Mobilepay::Client
Defined in:
lib/mobilepay/client/reservations.rb

Instance Method Summary collapse

Instance Method Details

#reservations(args = {}) ⇒ Object

Reservations_GetReservations Get the reservations for a particular date/time interval, and alternatively also for a specific customer



7
8
9
10
11
12
13
14
15
# File 'lib/mobilepay/client/reservations.rb', line 7

def reservations(args = {})
    check_args(datetime_from: args[:datetime_from], datetime_to: args[:datetime_to])
    address = "/reservations/merchants/#{merchant_id}/#{args[:datetime_from]}/#{args[:datetime_to]}"
    address += "?customerId=#{args[:customer_id]}" if args[:customer_id]
    response = call(:get, address, { body: '{}' })
    JSON.parse(response.body)
rescue Failure => ex
    return { error: ex.message }
end