Class: ServicesAutomation::Retrieve
- Inherits:
-
DSSM
- Object
- ServiceDs
- DSSM
- ServicesAutomation::Retrieve
show all
- Defined in:
- lib/services/retrieve.rb
Constant Summary
Constants inherited
from DSSM
DSSM::SERVICE_METHOD, DSSM::SERVICE_SERVER
Instance Method Summary
collapse
Methods inherited from DSSM
#do_call, #get_search_path, #status
Constructor Details
#initialize(*args) ⇒ Retrieve
Returns a new instance of Retrieve.
7
8
9
10
11
12
13
|
# File 'lib/services/retrieve.rb', line 7
def initialize(*args)
super
set_server(args[0] || SERVICE_SERVER)
set_path(args[1] || get_service_path)
set_method(args[2] || SERVICE_METHOD)
run_search(args[0] || SERVICE_SERVER)
end
|
Instance Method Details
#get_additionals ⇒ Object
118
119
120
|
# File 'lib/services/retrieve.rb', line 118
def get_additionals
cache['data']['destinationServiceDTO']['additionals']
end
|
#get_adult_max_age ⇒ Object
78
79
80
81
|
# File 'lib/services/retrieve.rb', line 78
def get_adult_max_age
raise 'adultMaxAge cannot be null' if cache['data']['destinationServiceDTO']['adultMaxAge'].nil?
cache['data']['destinationServiceDTO']['adultMaxAge']
end
|
#get_cancellation_policies ⇒ Object
101
102
103
104
|
# File 'lib/services/retrieve.rb', line 101
def get_cancellation_policies
cache['data']['destinationServiceDTO']['cancellationPolicies']
end
|
#get_child_max_age ⇒ Object
83
84
85
|
# File 'lib/services/retrieve.rb', line 83
def get_child_max_age
cache['data']['destinationServiceDTO']['childMaxAge']
end
|
#get_destination_iata ⇒ Object
48
49
50
51
|
# File 'lib/services/retrieve.rb', line 48
def get_destination_iata
raise 'destinationIATA cannot be null' if cache['data']['destinationServiceDTO']['destinationIATA'].nil?
cache['data']['destinationServiceDTO']['destinationIATA']
end
|
#get_distribution ⇒ Object
63
64
65
66
|
# File 'lib/services/retrieve.rb', line 63
def get_distribution
raise 'distribution cannot be null' if cache['data']['destinationServiceDTO']['distribution'].nil?
cache['data']['destinationServiceDTO']['distribution']
end
|
#get_dto ⇒ Object
15
16
17
18
|
# File 'lib/services/retrieve.rb', line 15
def get_dto
raise 'Destination Service DTO cannot be empty' if cache['data']['destinationServiceDTO'].empty?
cache['data']['destinationServiceDTO']
end
|
#get_from_date ⇒ Object
53
54
55
56
|
# File 'lib/services/retrieve.rb', line 53
def get_from_date
raise 'from date cannot be null' if cache['data']['destinationServiceDTO']['from'].nil?
cache['data']['destinationServiceDTO']['from']
end
|
#get_highlights ⇒ Object
106
107
108
|
# File 'lib/services/retrieve.rb', line 106
def get_highlights
cache['data']['destinationServiceDTO']['highlights']
end
|
#get_home_iata ⇒ Object
43
44
45
46
|
# File 'lib/services/retrieve.rb', line 43
def get_home_iata
raise 'homeIATA cannot be null' if cache['data']['destinationServiceDTO']['homeIATA'].nil?
cache['data']['destinationServiceDTO']['homeIATA']
end
|
#get_infant_max_age ⇒ Object
87
88
89
|
# File 'lib/services/retrieve.rb', line 87
def get_infant_max_age
cache['data']['destinationServiceDTO']['infantMaxAge']
end
|
#get_language ⇒ Object
38
39
40
41
|
# File 'lib/services/retrieve.rb', line 38
def get_language
raise 'language cannot be null' if cache['data']['destinationServiceDTO']['language'].nil?
cache['data']['destinationServiceDTO']['language']
end
|
#get_particular_conditions ⇒ Object
110
111
112
|
# File 'lib/services/retrieve.rb', line 110
def get_particular_conditions
cache['data']['destinationServiceDTO']['particularCondition']
end
|
#get_payment_plans ⇒ Object
96
97
98
99
|
# File 'lib/services/retrieve.rb', line 96
def get_payment_plans
raise 'creditCardPaymentPlans cannot be empty' if cache['data']['destinationServiceDTO']['creditCardPaymentPlans'].empty?
cache['data']['destinationServiceDTO']['creditCardPaymentPlans']
end
|
#get_price_by_currency(currency = "USD") ⇒ Object
122
123
124
125
|
# File 'lib/services/retrieve.rb', line 122
def get_price_by_currency(currency = "USD")
raise "The price should always be returned" if get_prices.select { | price | price['currency'] == "#{currency}" }.empty?
get_prices.select { | price | price['currency'] == "#{currency}" }.first
end
|
#get_prices ⇒ Object
91
92
93
94
|
# File 'lib/services/retrieve.rb', line 91
def get_prices
raise 'Prices cannot be empty' if cache['data']['destinationServiceDTO']['prices'].empty?
cache['data']['destinationServiceDTO']['prices']
end
|
#get_product_type ⇒ Object
114
115
116
|
# File 'lib/services/retrieve.rb', line 114
def get_product_type
cache['data']['destinationServiceDTO']['parentProductType']
end
|
#get_provider ⇒ Object
68
69
70
71
|
# File 'lib/services/retrieve.rb', line 68
def get_provider
raise 'destinationServiceProvider cannot be null' if cache['data']['destinationServiceDTO']['destinationServiceProvider'].nil?
cache['data']['destinationServiceDTO']['destinationServiceProvider']
end
|
#get_service_description ⇒ Object
34
35
36
|
# File 'lib/services/retrieve.rb', line 34
def get_service_description
cache['data']['destinationServiceDTO']['destinationServiceDescription']
end
|
#get_service_id ⇒ Object
24
25
26
27
|
# File 'lib/services/retrieve.rb', line 24
def get_service_id
raise 'destinationServiceID cannot be null' if cache['data']['destinationServiceDTO']['destinationServiceId'].nil?
cache['data']['destinationServiceDTO']['destinationServiceId']
end
|
#get_service_name ⇒ Object
29
30
31
32
|
# File 'lib/services/retrieve.rb', line 29
def get_service_name
raise 'destinationServiceName cannot be null' if cache['data']['destinationServiceDTO']['destinationServiceName'].nil?
cache['data']['destinationServiceDTO']['destinationServiceName']
end
|
#get_service_type ⇒ Object
73
74
75
76
|
# File 'lib/services/retrieve.rb', line 73
def get_service_type
raise 'destinationServiceType cannot be null' if cache['data']['destinationServiceDTO']['destinationServiceType'].nil?
cache['data']['destinationServiceDTO']['destinationServiceType']
end
|
#get_to_date ⇒ Object
58
59
60
61
|
# File 'lib/services/retrieve.rb', line 58
def get_to_date
raise 'to date cannot be null' if cache['data']['destinationServiceDTO']['to'].nil?
cache['data']['destinationServiceDTO']['to']
end
|
#get_total_price(currency = "USD") ⇒ Object
127
128
129
130
|
# File 'lib/services/retrieve.rb', line 127
def get_total_price(currency = "USD")
raise "The total price cannot be null" if get_price_by_currency(currency)['totalPrice'].nil?
get_price_by_currency(currency)['roundedTotalPrice']
end
|
#run_search ⇒ Object
20
21
22
|
# File 'lib/services/retrieve.rb', line 20
def run_search()
raise 'This method should be implemented in the concrete class'
end
|
#set_total_price_to_config ⇒ Object
132
133
134
135
|
# File 'lib/services/retrieve.rb', line 132
def set_total_price_to_config
raise "The total price cannot be null" if get_total_price.nil?
CONFIG[:retrieveTotalPrice] = get_total_price
end
|