Class: Centaman::Service::HoldTicket

Inherits:
Centaman::Service show all
Defined in:
lib/centaman/service/hold_ticket.rb

Constant Summary

Constants inherited from Wrapper

Wrapper::DEFAULT_TIMEOUT_TIME

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#api_password, #api_token, #api_url, #api_username, #proxie_host, #proxie_password, #proxie_port, #proxie_user

Instance Method Summary collapse

Methods inherited from Centaman::Service

#fetch_all, #post, #put

Methods inherited from Wrapper

#generate_token, #headers, #initialize, #payload, #payload_key, #proxy_hash, #wrap_request_in_case_of_timeout

Constructor Details

This class inherits a constructor from Centaman::Wrapper

Instance Attribute Details

#quantityObject (readonly)

Returns the value of attribute quantity.



3
4
5
# File 'lib/centaman/service/hold_ticket.rb', line 3

def quantity
  @quantity
end

#timed_ticket_idObject (readonly)

Returns the value of attribute timed_ticket_id.



3
4
5
# File 'lib/centaman/service/hold_ticket.rb', line 3

def timed_ticket_id
  @timed_ticket_id
end

#timed_ticket_type_idObject (readonly)

Returns the value of attribute timed_ticket_type_id.



3
4
5
# File 'lib/centaman/service/hold_ticket.rb', line 3

def timed_ticket_type_id
  @timed_ticket_type_id
end

Instance Method Details

#after_init(args) ⇒ Object



5
6
7
8
9
# File 'lib/centaman/service/hold_ticket.rb', line 5

def after_init(args)
  @timed_ticket_type_id = args[:timed_ticket_type_id]
  @timed_ticket_id = args[:timed_ticket_id]
  @quantity = args[:quantity]
end

#after_post(response) ⇒ Object



11
12
13
# File 'lib/centaman/service/hold_ticket.rb', line 11

def after_post(response)
  response.parsed_response
end

#endpointObject



15
16
17
# File 'lib/centaman/service/hold_ticket.rb', line 15

def endpoint
  '/ticket_services/TimedTicketType'
end

#object_classObject



19
20
21
# File 'lib/centaman/service/hold_ticket.rb', line 19

def object_class
  Centaman::Object::BookingTime
end

#optionsObject



33
34
35
36
37
38
39
# File 'lib/centaman/service/hold_ticket.rb', line 33

def options
  super + [
    { key: 'TimedTicketTypeId', value: timed_ticket_type_id.to_i },
    { key: 'TimedTicketId', value: timed_ticket_id },
    { key: 'NumberOfTickets', value: quantity }
  ]
end

#options_hashObject



23
24
25
26
27
28
29
30
31
# File 'lib/centaman/service/hold_ticket.rb', line 23

def options_hash
  [
    {
      'TimedTicketTypeId' => timed_ticket_type_id.to_i,
      'TimedTicketId' => timed_ticket_id,
      'NumberOfTickets' => quantity
    }
  ].to_json
end