Class: Starapi::SoapServiceTarget::PriceQuote
- Defined in:
- lib/starapi/soap_service_target/price_quote.rb
Constant Summary collapse
- @@PROC_TYPE =
"GU_sp_DR_Price_Quote"
Instance Attribute Summary collapse
-
#entno ⇒ Object
Returns the value of attribute entno.
-
#last_response ⇒ Object
readonly
Returns the value of attribute last_response.
-
#request_date ⇒ Object
Returns the value of attribute request_date.
-
#request_xml ⇒ Object
readonly
Returns the value of attribute request_xml.
-
#rev_type ⇒ Object
Returns the value of attribute rev_type.
-
#supno ⇒ Object
Returns the value of attribute supno.
Attributes inherited from Base
Instance Method Summary collapse
- #construct_xml ⇒ Object
-
#initialize(entno, supno, rev_type, request_date) ⇒ PriceQuote
constructor
A new instance of PriceQuote.
- #parse_response ⇒ Object
- #soap_price_quote! ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(entno, supno, rev_type, request_date) ⇒ PriceQuote
Returns a new instance of PriceQuote.
39 40 41 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 39 def initialize(entno, supno, rev_type, request_date) @entno, @supno, @rev_type, @request_date = entno, supno, rev_type, request_date end |
Instance Attribute Details
#entno ⇒ Object
Returns the value of attribute entno.
36 37 38 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 36 def entno @entno end |
#last_response ⇒ Object (readonly)
Returns the value of attribute last_response.
36 37 38 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 36 def last_response @last_response end |
#request_date ⇒ Object
Returns the value of attribute request_date.
36 37 38 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 36 def request_date @request_date end |
#request_xml ⇒ Object (readonly)
Returns the value of attribute request_xml.
36 37 38 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 36 def request_xml @request_xml end |
#rev_type ⇒ Object
Returns the value of attribute rev_type.
36 37 38 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 36 def rev_type @rev_type end |
#supno ⇒ Object
Returns the value of attribute supno.
36 37 38 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 36 def supno @supno end |
Instance Method Details
#construct_xml ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 43 def construct_xml Nokogiri::XML::Builder.new do |xml| xml.ReadiSystem do xml.proc_type @@PROC_TYPE xml.entno @entno xml.supno @supno xml.rev_type @rev_type xml.request_date @request_date end end end |
#parse_response ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 60 def parse_response if @last_response.blank? raise StandardError.new "Response is not loaded. It looks like the request was not made." end xml = Nokogiri::XML(@last_response) parsed_obj = OpenStruct.new parsed_obj.entno = xml.xpath("//entno").text parsed_obj.supno = xml.xpath("//supno").text parsed_obj.offer_desc = xml.xpath("//offer_desc").text parsed_obj.rev_type = xml.xpath("//rev_type").text parsed_obj.price_desc = xml.xpath("//price_desc").text parsed_obj.enroll_eff_date = xml.xpath("//enroll_eff_date").text parsed_obj.enroll_exp_date = xml.xpath("//enroll_exp_date").text parsed_obj.offer_price = xml.xpath("//offer_price").text parsed_obj.price_uom = xml.xpath("//price_uom").text parsed_obj.price_to_compare = xml.xpath("//price_to_compare").text parsed_obj. = xml.xpath("//ptc_message").text parsed_obj end |
#soap_price_quote! ⇒ Object
55 56 57 58 |
# File 'lib/starapi/soap_service_target/price_quote.rb', line 55 def soap_price_quote! @request_xml = construct_xml.to_xml @last_response = get_target_response soap_service_sp.soap_execute_sp!(@request_xml) end |