Class: Deliveries::Couriers::CorreosExpress::CollectionPoints::Search::FormatResponse
- Inherits:
-
Object
- Object
- Deliveries::Couriers::CorreosExpress::CollectionPoints::Search::FormatResponse
- Defined in:
- lib/deliveries/couriers/correos_express/collection_points/search/format_response.rb
Constant Summary collapse
- SATURDAY_HOUR_KEY =
'S:'.freeze
- WORKDAY_HOUR_KEY =
'L-V:'.freeze
- HOLIDAY_HOUR_KEY =
'Festivos:'.freeze
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(response:) ⇒ FormatResponse
constructor
A new instance of FormatResponse.
Constructor Details
#initialize(response:) ⇒ FormatResponse
Returns a new instance of FormatResponse.
22 23 24 |
# File 'lib/deliveries/couriers/correos_express/collection_points/search/format_response.rb', line 22 def initialize(response:) self.response = response end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
20 21 22 |
# File 'lib/deliveries/couriers/correos_express/collection_points/search/format_response.rb', line 20 def response @response end |
Instance Method Details
#execute ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/deliveries/couriers/correos_express/collection_points/search/format_response.rb', line 26 def execute collection_point = {} collection_point[:courier_id] = 'correos_express' collection_point[:name] = response['nombreOficina'] collection_point[:point_id] = response['codigoOficina'] collection_point[:street] = response['direccionOficina'] collection_point[:city] = response['poblacionOficina'] collection_point[:postcode] = response['codigoPostalOficina'] latitude, longitude = response['geoposicionOficina'].split(',') collection_point[:latitude] = latitude.to_f collection_point[:longitude] = longitude.to_f collection_point[:timetable] = (response['horarioOficina']) collection_point end |