Class: AlfaInsurance::BusInsuranceRequest
- Inherits:
-
Object
- Object
- AlfaInsurance::BusInsuranceRequest
- Defined in:
- lib/alfa_insurance/insurance.rb
Instance Attribute Summary collapse
-
#bus_segments ⇒ Object
readonly
Returns the value of attribute bus_segments.
-
#customer_email ⇒ Object
readonly
Returns the value of attribute customer_email.
-
#customer_phone ⇒ Object
readonly
Returns the value of attribute customer_phone.
-
#insured_birth_date ⇒ Object
readonly
Returns the value of attribute insured_birth_date.
-
#insured_document_number ⇒ Object
readonly
Returns the value of attribute insured_document_number.
-
#insured_document_type ⇒ Object
readonly
Returns the value of attribute insured_document_type.
-
#insured_first_name ⇒ Object
readonly
Returns the value of attribute insured_first_name.
-
#insured_last_name ⇒ Object
readonly
Returns the value of attribute insured_last_name.
-
#insured_patronymic ⇒ Object
readonly
Returns the value of attribute insured_patronymic.
-
#total_value ⇒ Object
readonly
Returns the value of attribute total_value.
Instance Method Summary collapse
- #generate_xml(xml) ⇒ Object
-
#initialize(params = {}) ⇒ BusInsuranceRequest
constructor
A new instance of BusInsuranceRequest.
Constructor Details
#initialize(params = {}) ⇒ BusInsuranceRequest
Returns a new instance of BusInsuranceRequest.
30 31 32 33 34 |
# File 'lib/alfa_insurance/insurance.rb', line 30 def initialize(params = {}) params.each do |attr, value| instance_variable_set("@#{attr}", value) end end |
Instance Attribute Details
#bus_segments ⇒ Object (readonly)
Returns the value of attribute bus_segments.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def bus_segments @bus_segments end |
#customer_email ⇒ Object (readonly)
Returns the value of attribute customer_email.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def customer_email @customer_email end |
#customer_phone ⇒ Object (readonly)
Returns the value of attribute customer_phone.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def customer_phone @customer_phone end |
#insured_birth_date ⇒ Object (readonly)
Returns the value of attribute insured_birth_date.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def insured_birth_date @insured_birth_date end |
#insured_document_number ⇒ Object (readonly)
Returns the value of attribute insured_document_number.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def insured_document_number @insured_document_number end |
#insured_document_type ⇒ Object (readonly)
Returns the value of attribute insured_document_type.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def insured_document_type @insured_document_type end |
#insured_first_name ⇒ Object (readonly)
Returns the value of attribute insured_first_name.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def insured_first_name @insured_first_name end |
#insured_last_name ⇒ Object (readonly)
Returns the value of attribute insured_last_name.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def insured_last_name @insured_last_name end |
#insured_patronymic ⇒ Object (readonly)
Returns the value of attribute insured_patronymic.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def insured_patronymic @insured_patronymic end |
#total_value ⇒ Object (readonly)
Returns the value of attribute total_value.
19 20 21 |
# File 'lib/alfa_insurance/insurance.rb', line 19 def total_value @total_value end |
Instance Method Details
#generate_xml(xml) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/alfa_insurance/insurance.rb', line 36 def generate_xml(xml) xml.insuredFirstName(insured_first_name) xml.insuredLastName(insured_last_name) xml.insuredPatronymic(insured_patronymic) xml.insuredBirthDate(insured_birth_date) xml.insuredCount(1) # xml.insuredDocumentType(insured_document_type) # xml.insuredDocumentNumber(insured_document_number) bus_segments.each_with_index do |segment, index| xml.busSegmentRouteNumber(seqNo: index) { xml.value(segment.route_number) } xml.busSegmentPlaceNumber(seqNo: index) { xml.value(segment.place_number) } xml.busSegmentDepartureStation(seqNo: index) { xml.value(segment.departure_station) } xml.busSegmentDepartureDate(seqNo: index) { xml.value(segment.departure_at.to_date.iso8601) } xml.busSegmentDepartureTime(seqNo: index) { xml.value(segment.departure_at.strftime("%H:%M:%S")) } xml.busSegmentArrivalStation(seqNo: index) { xml.value(segment.arrival_station) } xml.busSegmentArrivalDate(seqNo: index) { xml.value(segment.arrival_at.to_date.iso8601) } xml.busSegmentArrivalTime(seqNo: index) { xml.value(segment.arrival_at.strftime("%H:%M:%S")) } xml.busSegmentNumber(seqNo: index) { xml.value(segment.number) } end xml.busSegmentsCount(bus_segments.size) xml.ticketInformation { xml.ticketTotalValue(total_value.to_f) } xml.customerPhoneType 'MOBILE' xml.customerPhone customer_phone xml.customerEmail customer_email xml end |