Class: Velix::Modules::Events
- Inherits:
-
Object
- Object
- Velix::Modules::Events
- Defined in:
- lib/velix/modules/events.rb
Overview
/v1/api/events/id/guests — Velix Events guest endpoints.
Only two operations exist in the real API: creating a guest (events:write) and reading one back (events:read). There is no list/find/create/update/delete-event or update-config endpoint under the API-key surface — do not add methods for those without a corresponding spec entry.
Defined Under Namespace
Classes: Guest
Instance Method Summary collapse
-
#create_guest(event_id, name:, email:, cpf: nil, phone: nil, birth_date: nil, category_id: nil, companion_of: nil) ⇒ Object
cpf, phone, birth_date, category_id, companion_of are optional.
- #get_guest(event_id, guest_id) ⇒ Object
-
#initialize(client) ⇒ Events
constructor
A new instance of Events.
Constructor Details
#initialize(client) ⇒ Events
Returns a new instance of Events.
15 16 17 |
# File 'lib/velix/modules/events.rb', line 15 def initialize(client) @client = client end |
Instance Method Details
#create_guest(event_id, name:, email:, cpf: nil, phone: nil, birth_date: nil, category_id: nil, companion_of: nil) ⇒ Object
cpf, phone, birth_date, category_id, companion_of are optional.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/velix/modules/events.rb', line 20 def create_guest(event_id, name:, email:, cpf: nil, phone: nil, birth_date: nil, category_id: nil, companion_of: nil) body = { name: name, email: email } body[:cpf] = cpf if cpf body[:phone] = phone if phone body[:birthDate] = birth_date if birth_date body[:categoryId] = category_id if category_id body[:companionOf] = companion_of if companion_of resp = @client.post("/v1/api/events/#{event_id}/guests", body) build_guest(resp) end |
#get_guest(event_id, guest_id) ⇒ Object
33 34 35 36 |
# File 'lib/velix/modules/events.rb', line 33 def get_guest(event_id, guest_id) resp = @client.get("/v1/api/events/#{event_id}/guests/#{guest_id}") build_guest(resp) end |