Class: Centaman::Service::Extra
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
#build_object, #build_objects, #final_object_class
#after_post, #fetch_all, #post, #put
Methods inherited from Wrapper
#generate_token, #headers, #initialize, #options_hash, #payload, #payload_key, #proxy_hash, #wrap_request_in_case_of_timeout
Instance Attribute Details
#booking_time_id ⇒ Object
Returns the value of attribute booking_time_id.
4
5
6
|
# File 'lib/centaman/service/extra.rb', line 4
def booking_time_id
@booking_time_id
end
|
#cost_rate_id ⇒ Object
Returns the value of attribute cost_rate_id.
4
5
6
|
# File 'lib/centaman/service/extra.rb', line 4
def cost_rate_id
@cost_rate_id
end
|
Instance Method Details
#additional_hash_to_serialize_after_response ⇒ Object
27
28
29
30
31
|
# File 'lib/centaman/service/extra.rb', line 27
def additional_hash_to_serialize_after_response
{
booking_time_id: booking_time_id
}
end
|
#after_init(args) ⇒ Object
6
7
8
9
10
|
# File 'lib/centaman/service/extra.rb', line 6
def after_init(args)
@booking_time_id = args[:booking_time_id]
@cost_rate_id = args[:cost_rate_id]
require_args
end
|
12
13
14
|
# File 'lib/centaman/service/extra.rb', line 12
def endpoint
'/ticket_services/TimedTicketExtra'
end
|
47
48
49
|
# File 'lib/centaman/service/extra.rb', line 47
def objects
Rails.env.test? ? build_objects(sample_response) : super
end
|
20
21
22
23
24
25
|
# File 'lib/centaman/service/extra.rb', line 20
def options
super + [
{ key: 'TimedTicketTypeId', value: booking_time_id },
{ key: 'CostRateId', value: cost_rate_id }
]
end
|
#require_args ⇒ Object
33
34
35
|
# File 'lib/centaman/service/extra.rb', line 33
def require_args
raise "booking_time_id is required for #{self.class.name}" if booking_time_id.nil?
end
|
#sample_response ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/centaman/service/extra.rb', line 37
def sample_response
[{
'ExtraId' => 581,
'ExtraDescription' => 'Bar Package Cocktail Cruises',
'ExtraPrice' => 22.05,
'DepositPercentage' => 100.0,
'IsTaxInclusive' => true, 'TaxPercentage' => 10.25
}]
end
|