Class: Seatsio::HoldTokensClient

Inherits:
Object
  • Object
show all
Defined in:
lib/seatsio/hold_tokens.rb

Instance Method Summary collapse

Constructor Details

#initialize(http_client) ⇒ Seatsio::HoldTokensClient



14
15
16
# File 'lib/seatsio/hold_tokens.rb', line 14

def initialize(http_client)
  @http_client = http_client
end

Instance Method Details

#create(expires_in_minutes: nil) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/seatsio/hold_tokens.rb', line 18

def create(expires_in_minutes: nil)
  body = {}
  if expires_in_minutes
    body[:expiresInMinutes] = expires_in_minutes
  end
  response = @http_client.post('hold-tokens', body)
  HoldToken.new(response)
end

#expire_in_minutes(hold_token, expires_in_minutes = nil) ⇒ Object



32
33
34
35
36
# File 'lib/seatsio/hold_tokens.rb', line 32

def expire_in_minutes(hold_token, expires_in_minutes = nil)
  body = {"expiresInMinutes": expires_in_minutes}
  response = @http_client.post("hold-tokens/#{hold_token}", body)
  HoldToken.new(response)
end

#retrieve(hold_token) ⇒ Object



27
28
29
30
# File 'lib/seatsio/hold_tokens.rb', line 27

def retrieve(hold_token)
  response = @http_client.get("hold-tokens/#{hold_token}")
  HoldToken.new(response)
end