Class: Luma::Appointment

Inherits:
Connection show all
Defined in:
lib/luma/appointment.rb

Constant Summary collapse

APPOINTMENT_ENDPOINT =
'/api/appointments'.freeze

Constants inherited from Connection

Connection::DEFAULT_ENDPOINT

Instance Method Summary collapse

Methods inherited from Connection

#add_headers_and_body, #initialize, #request

Constructor Details

This class inherits a constructor from Luma::Connection

Instance Method Details

#create_appointment(endpoint: APPOINTMENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout) ⇒ Object



7
8
9
10
11
12
# File 'lib/luma/appointment.rb', line 7

def create_appointment(endpoint: APPOINTMENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout)
   @body = body
   self.add_headers_and_body if auth

   self.class.send(verb.to_s, endpoint, body: @body, headers: @headers)
end

#update_appointment(appt_identifier, endpoint: APPOINTMENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/luma/appointment.rb', line 14

def update_appointment(appt_identifier, endpoint: APPOINTMENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout)
   @body = body
   self.add_headers_and_body if auth

   endpoint = "#{endpoint}/#{appt_identifier}"

   self.class.send(verb.to_s, endpoint, body: @body, headers: @headers)
end