Class: Agris::Api::Grain::NewContract

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

Constant Summary collapse

ATTRIBUTE_NAMES =
%w(
  purchase_sales
  contract_location
  contract_number
  contract_type
  commodity
  varietyclass
  status
  quantity_base
  weight_base
  grade_base
  signed
  date_written
  contract_name_id
  ship_to_from_id
  misc_id
  agent_broker_id
  external_contract_no
  delivery_terms
  transport_mode
  dp_table
  invoice_terms
  scheduled_quantity
  contract_loads
  advance_percent
  quantity_uom
  add_update_option
).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XmlModel

included

Constructor Details

#initialize(hash = {}) ⇒ NewContract

Returns a new instance of NewContract.



41
42
43
44
45
# File 'lib/agris/api/grain/new_contract.rb', line 41

def initialize(hash = {})
  super

  @record_type = 'GRNC0'
end

Instance Attribute Details

#record_typeObject (readonly)

Returns the value of attribute record_type.



38
39
40
# File 'lib/agris/api/grain/new_contract.rb', line 38

def record_type
  @record_type
end

Instance Method Details

#add_remark(remark) ⇒ Object



54
55
56
57
58
59
# File 'lib/agris/api/grain/new_contract.rb', line 54

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

  self
end

#add_schedule(schedule) ⇒ Object



47
48
49
50
51
52
# File 'lib/agris/api/grain/new_contract.rb', line 47

def add_schedule(schedule)
  @schedules ||= []
  @schedules << schedule

  self
end

#recordsObject



69
70
71
# File 'lib/agris/api/grain/new_contract.rb', line 69

def records
  [self] + schedules + remarks
end

#remarksObject



65
66
67
# File 'lib/agris/api/grain/new_contract.rb', line 65

def remarks
  @remarks || []
end

#schedulesObject



61
62
63
# File 'lib/agris/api/grain/new_contract.rb', line 61

def schedules
  @schedules || []
end

#xml_ignore_attributesObject



73
74
75
# File 'lib/agris/api/grain/new_contract.rb', line 73

def xml_ignore_attributes
  %i(schedules remarks)
end