Class: Agris::Api::Grain::NewTicket

Inherits:
Object
  • Object
show all
Includes:
XmlModel
Defined in:
lib/agris/api/grain/new_ticket.rb

Constant Summary collapse

ATTRIBUTE_NAMES =
%w(
  in_out_code
  ticket_location
  ticket_number
  type
  shipment_date
  entry_date
  ship_to_from_id
  commodity
  variety_class
  storage_bin
  transport_mode
  shipper_id
  vehicle_id
  other_ref
  trancode_4
  trancode_5
  weight_base
  grade_base
  freight_status
  disc_tables
  net_quantity
  gross_weight
  tare_weight
  freight_weight
  freight_rate
  additional_freight
  cash_price
  cash_basis
  gross_date
  gross_time
  gross_entry_method
  tare_date
  tare_time
  tare_entry_method
  driver_id
  car_set_date
  notify_date
  days_allowed
  short_sample_number
  add_update_reverse_option
  adjust_inventory
  freight_tax_percent
  shipment_id
  update_field_selection
  grade_agency_id
  grade_certificate_date
  grade_certificate_number
  weight_agency_id
  weight_certificate_date
  weight_certificate_number
  hauler_id
  weight_uom
  quantity_uom
  freight_currency
  exchange_rate
  exchange_rate_date
  their_invoice_number
  exec_id
  reverse_instruction
  first_4_discount_tables
  sample_number
  last_4_discount_tables
  split_group
  producer_id
  farm
  field
).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XmlModel

included

Constructor Details

#initialize(hash = {}) ⇒ NewTicket

Returns a new instance of NewTicket.



80
81
82
83
84
# File 'lib/agris/api/grain/new_ticket.rb', line 80

def initialize(hash = {})
  super

  @record_type = 'GRNT0'
end

Instance Attribute Details

#record_typeObject (readonly)

Returns the value of attribute record_type.



77
78
79
# File 'lib/agris/api/grain/new_ticket.rb', line 77

def record_type
  @record_type
end

Instance Method Details

#add_application(application) ⇒ Object



86
87
88
89
90
91
# File 'lib/agris/api/grain/new_ticket.rb', line 86

def add_application(application)
  @applications ||= []
  @applications << application

  self
end

#add_remark(remark) ⇒ Object



93
94
95
96
97
98
# File 'lib/agris/api/grain/new_ticket.rb', line 93

def add_remark(remark)
  @remarks ||= []
  @remarks << remark

  self
end

#applicationsObject



100
101
102
# File 'lib/agris/api/grain/new_ticket.rb', line 100

def applications
  @applications || []
end

#recordsObject



104
105
106
# File 'lib/agris/api/grain/new_ticket.rb', line 104

def records
  [self] + applications + remarks
end

#remarksObject



108
109
110
# File 'lib/agris/api/grain/new_ticket.rb', line 108

def remarks
  @remarks || []
end

#xml_ignore_attributesObject



112
113
114
# File 'lib/agris/api/grain/new_ticket.rb', line 112

def xml_ignore_attributes
  %i(applications remarks)
end