Class: Suretax::Api::RequestItem
- Inherits:
-
Object
- Object
- Suretax::Api::RequestItem
- Includes:
- Concerns::Validatable
- Defined in:
- lib/suretax/api/request_item.rb
Instance Attribute Summary collapse
-
#aux_revenue ⇒ Object
Returns the value of attribute aux_revenue.
-
#aux_revenue_type ⇒ Object
Returns the value of attribute aux_revenue_type.
-
#bill_to_number ⇒ Object
Returns the value of attribute bill_to_number.
-
#common_carrier ⇒ Object
Returns the value of attribute common_carrier.
-
#customer_number ⇒ Object
Returns the value of attribute customer_number.
-
#dest_country_code ⇒ Object
Returns the value of attribute dest_country_code.
-
#freight_on_board ⇒ Object
Returns the value of attribute freight_on_board.
-
#geocode ⇒ Object
Returns the value of attribute geocode.
-
#invoice_number ⇒ Object
Returns the value of attribute invoice_number.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#mail_order ⇒ Object
Returns the value of attribute mail_order.
-
#order_approval_plus_four ⇒ Object
Returns the value of attribute order_approval_plus_four.
-
#order_approval_zipcode ⇒ Object
Returns the value of attribute order_approval_zipcode.
-
#order_placement_plus_four ⇒ Object
Returns the value of attribute order_placement_plus_four.
-
#order_placement_zipcode ⇒ Object
Returns the value of attribute order_placement_zipcode.
-
#orig_number ⇒ Object
Returns the value of attribute orig_number.
-
#origin_country_code ⇒ Object
Returns the value of attribute origin_country_code.
-
#p_to_p_plus_four ⇒ Object
Returns the value of attribute p_to_p_plus_four.
-
#p_to_p_zipcode ⇒ Object
Returns the value of attribute p_to_p_zipcode.
-
#plus_four ⇒ Object
Returns the value of attribute plus_four.
-
#regulatory_code ⇒ Object
Returns the value of attribute regulatory_code.
-
#revenue ⇒ Object
Returns the value of attribute revenue.
-
#sales_type_code ⇒ Object
Returns the value of attribute sales_type_code.
-
#seconds ⇒ Object
Returns the value of attribute seconds.
-
#ship_from_plus_four ⇒ Object
Returns the value of attribute ship_from_plus_four.
-
#ship_from_pob ⇒ Object
Returns the value of attribute ship_from_pob.
-
#ship_from_zipcode ⇒ Object
Returns the value of attribute ship_from_zipcode.
-
#tax_exemption_codes ⇒ Object
Returns the value of attribute tax_exemption_codes.
-
#tax_included_code ⇒ Object
Returns the value of attribute tax_included_code.
-
#tax_situs_rule ⇒ Object
Returns the value of attribute tax_situs_rule.
-
#term_number ⇒ Object
Returns the value of attribute term_number.
-
#trans_date ⇒ Object
Returns the value of attribute trans_date.
-
#trans_type_code ⇒ Object
Returns the value of attribute trans_type_code.
-
#unit_type ⇒ Object
Returns the value of attribute unit_type.
-
#units ⇒ Object
Returns the value of attribute units.
-
#user_defined_field ⇒ Object
Returns the value of attribute user_defined_field.
-
#zipcode ⇒ Object
Returns the value of attribute zipcode.
Instance Method Summary collapse
- #blank(value) ⇒ Object
-
#initialize(args = {}) ⇒ RequestItem
constructor
A new instance of RequestItem.
- #params ⇒ Object
- #presence(value) ⇒ Object
Methods included from Concerns::Validatable
Constructor Details
#initialize(args = {}) ⇒ RequestItem
Returns a new instance of RequestItem.
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/suretax/api/request_item.rb', line 56 def initialize(args = {}) args.each_pair do |key, value| send("#{key}=", value.to_s) end @tax_exemption_codes = [] args[:tax_exemption_codes]&.each do |code| @tax_exemption_codes << code.to_s end validate! end |
Instance Attribute Details
#aux_revenue ⇒ Object
Returns the value of attribute aux_revenue.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def aux_revenue @aux_revenue end |
#aux_revenue_type ⇒ Object
Returns the value of attribute aux_revenue_type.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def aux_revenue_type @aux_revenue_type end |
#bill_to_number ⇒ Object
Returns the value of attribute bill_to_number.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def bill_to_number @bill_to_number end |
#common_carrier ⇒ Object
Returns the value of attribute common_carrier.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def common_carrier @common_carrier end |
#customer_number ⇒ Object
Returns the value of attribute customer_number.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def customer_number @customer_number end |
#dest_country_code ⇒ Object
Returns the value of attribute dest_country_code.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def dest_country_code @dest_country_code end |
#freight_on_board ⇒ Object
Returns the value of attribute freight_on_board.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def freight_on_board @freight_on_board end |
#geocode ⇒ Object
Returns the value of attribute geocode.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def geocode @geocode end |
#invoice_number ⇒ Object
Returns the value of attribute invoice_number.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def invoice_number @invoice_number end |
#line_number ⇒ Object
Returns the value of attribute line_number.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def line_number @line_number end |
#mail_order ⇒ Object
Returns the value of attribute mail_order.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def mail_order @mail_order end |
#order_approval_plus_four ⇒ Object
Returns the value of attribute order_approval_plus_four.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def order_approval_plus_four @order_approval_plus_four end |
#order_approval_zipcode ⇒ Object
Returns the value of attribute order_approval_zipcode.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def order_approval_zipcode @order_approval_zipcode end |
#order_placement_plus_four ⇒ Object
Returns the value of attribute order_placement_plus_four.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def order_placement_plus_four @order_placement_plus_four end |
#order_placement_zipcode ⇒ Object
Returns the value of attribute order_placement_zipcode.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def order_placement_zipcode @order_placement_zipcode end |
#orig_number ⇒ Object
Returns the value of attribute orig_number.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def orig_number @orig_number end |
#origin_country_code ⇒ Object
Returns the value of attribute origin_country_code.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def origin_country_code @origin_country_code end |
#p_to_p_plus_four ⇒ Object
Returns the value of attribute p_to_p_plus_four.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def p_to_p_plus_four @p_to_p_plus_four end |
#p_to_p_zipcode ⇒ Object
Returns the value of attribute p_to_p_zipcode.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def p_to_p_zipcode @p_to_p_zipcode end |
#plus_four ⇒ Object
Returns the value of attribute plus_four.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def plus_four @plus_four end |
#regulatory_code ⇒ Object
Returns the value of attribute regulatory_code.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def regulatory_code @regulatory_code end |
#revenue ⇒ Object
Returns the value of attribute revenue.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def revenue @revenue end |
#sales_type_code ⇒ Object
Returns the value of attribute sales_type_code.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def sales_type_code @sales_type_code end |
#seconds ⇒ Object
Returns the value of attribute seconds.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def seconds @seconds end |
#ship_from_plus_four ⇒ Object
Returns the value of attribute ship_from_plus_four.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def ship_from_plus_four @ship_from_plus_four end |
#ship_from_pob ⇒ Object
Returns the value of attribute ship_from_pob.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def ship_from_pob @ship_from_pob end |
#ship_from_zipcode ⇒ Object
Returns the value of attribute ship_from_zipcode.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def ship_from_zipcode @ship_from_zipcode end |
#tax_exemption_codes ⇒ Object
Returns the value of attribute tax_exemption_codes.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def tax_exemption_codes @tax_exemption_codes end |
#tax_included_code ⇒ Object
Returns the value of attribute tax_included_code.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def tax_included_code @tax_included_code end |
#tax_situs_rule ⇒ Object
Returns the value of attribute tax_situs_rule.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def tax_situs_rule @tax_situs_rule end |
#term_number ⇒ Object
Returns the value of attribute term_number.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def term_number @term_number end |
#trans_date ⇒ Object
Returns the value of attribute trans_date.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def trans_date @trans_date end |
#trans_type_code ⇒ Object
Returns the value of attribute trans_type_code.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def trans_type_code @trans_type_code end |
#unit_type ⇒ Object
Returns the value of attribute unit_type.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def unit_type @unit_type end |
#units ⇒ Object
Returns the value of attribute units.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def units @units end |
#user_defined_field ⇒ Object
Returns the value of attribute user_defined_field.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def user_defined_field @user_defined_field end |
#zipcode ⇒ Object
Returns the value of attribute zipcode.
6 7 8 |
# File 'lib/suretax/api/request_item.rb', line 6 def zipcode @zipcode end |
Instance Method Details
#blank(value) ⇒ Object
115 116 117 |
# File 'lib/suretax/api/request_item.rb', line 115 def blank(value) value.respond_to?(:empty?) ? !!value.empty? : !value end |
#params ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/suretax/api/request_item.rb', line 69 def params { "LineNumber" => line_number, "InvoiceNumber" => invoice_number, "CustomerNumber" => customer_number, "OrigNumber" => orig_number || "", "TermNumber" => term_number || "", "BillToNumber" => bill_to_number || "", "Zipcode" => zipcode, "Plus4" => plus_four, "P2PZipcode" => p_to_p_zipcode || "", "P2PPlus4" => p_to_p_plus_four || "", "TransDate" => trans_date || Date.today.strftime("%m-%d-%Y"), "Revenue" => revenue.to_f, "Units" => units.to_i, "UnitType" => presence(unit_type) || "00", "Seconds" => seconds.to_i, "TaxIncludedCode" => tax_included_code, "TaxSitusRule" => tax_situs_rule, "TransTypeCode" => trans_type_code, "SalesTypeCode" => sales_type_code, "RegulatoryCode" => regulatory_code, "TaxExemptionCodeList" => tax_exemption_codes, "UDF" => user_defined_field || "", "ShipFromZipCode" => ship_from_zipcode || "", "ShipFromPlus4" => ship_from_plus_four || "", "OrderPlacementZipcode" => order_placement_zipcode || "", "OrderPlacementPlus4" => order_approval_plus_four || "", "OrderApprovalZipcode" => order_approval_zipcode || "", "OrderApprovalPlus4" => order_approval_plus_four || "", "Geocode" => geocode || "", "AuxRevenue" => presence(aux_revenue) || "0.00", "AuxRevenueType" => presence(aux_revenue_type) || "01", "FreightOnBoard" => freight_on_board || "", "ShipFromPOB" => presence(ship_from_pob) || "1", "MailOrder" => presence(mail_order) || "1", "CommonCarrier" => presence(common_carrier) || "1", "OriginCountryCode" => origin_country_code || "", "DestCountryCode" => dest_country_code || "" } end |
#presence(value) ⇒ Object
111 112 113 |
# File 'lib/suretax/api/request_item.rb', line 111 def presence(value) value unless blank(value) end |