Class: Beanie::ProductionOrder

Inherits:
Api
  • Object
show all
Defined in:
lib/beanie/bill_of_material.rb,
lib/beanie/production_order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Api

all, build_url, delete, #extract, #field_name, find, get, #object_name, #populate, post, put, #save!, set_headers

Constructor Details

#initializeProductionOrder

Initialize instance variables



36
37
38
39
40
41
42
# File 'lib/beanie/bill_of_material.rb', line 36

def initialize
  @id = nil
  @name = nil
  @revision = nil
  @description = nil
  @stock_item_id = nil
end

Instance Attribute Details

#bill_of_material_idObject

Returns the value of attribute bill_of_material_id.



33
34
35
# File 'lib/beanie/production_order.rb', line 33

def bill_of_material_id
  @bill_of_material_id
end

#descriptionObject

Returns the value of attribute description.



32
33
34
# File 'lib/beanie/bill_of_material.rb', line 32

def description
  @description
end

#idObject

Returns the value of attribute id.



32
33
34
# File 'lib/beanie/bill_of_material.rb', line 32

def id
  @id
end

#nameObject

Returns the value of attribute name.



32
33
34
# File 'lib/beanie/bill_of_material.rb', line 32

def name
  @name
end

#notesObject

Returns the value of attribute notes.



32
33
34
# File 'lib/beanie/production_order.rb', line 32

def notes
  @notes
end

#numberObject

Returns the value of attribute number.



32
33
34
# File 'lib/beanie/production_order.rb', line 32

def number
  @number
end

#quantityObject

Returns the value of attribute quantity.



32
33
34
# File 'lib/beanie/production_order.rb', line 32

def quantity
  @quantity
end

#revisionObject

Returns the value of attribute revision.



32
33
34
# File 'lib/beanie/bill_of_material.rb', line 32

def revision
  @revision
end

#sales_order_idObject

Returns the value of attribute sales_order_id.



33
34
35
# File 'lib/beanie/production_order.rb', line 33

def sales_order_id
  @sales_order_id
end

#stateObject

Returns the value of attribute state.



32
33
34
# File 'lib/beanie/production_order.rb', line 32

def state
  @state
end

#stock_item_idObject

Returns the value of attribute stock_item_id.



32
33
34
# File 'lib/beanie/bill_of_material.rb', line 32

def stock_item_id
  @stock_item_id
end

#work_centre_group_idObject

Returns the value of attribute work_centre_group_id.



33
34
35
# File 'lib/beanie/production_order.rb', line 33

def work_centre_group_id
  @work_centre_group_id
end

Instance Method Details

#construct_path(opts = {}) ⇒ Object

Construct the path a little differently…



69
70
71
72
73
74
# File 'lib/beanie/production_order.rb', line 69

def construct_path(opts = {})
  raise ":work_centre_group_id is not defined" unless opts[:work_centre_group_id]
  path = "/work_centre_groups/#{opts[:work_centre_group_id]}/production_orders"
  opts.delete(:work_centre_group_id)
  path
end

#private_dataObject

Get the private data



51
52
53
54
55
56
57
# File 'lib/beanie/production_order.rb', line 51

def private_data
  unless @_private_data
    response = ProductionOrder.get(:url => "/production_orders/#{@id}/private_data")
    @_private_data = response["data"]
  end
  return @_private_data
end

#private_data=(data) ⇒ Object

Update/set the private data



61
62
63
64
65
# File 'lib/beanie/production_order.rb', line 61

def private_data=(data)
  @_private_data = data
  pdata = {:data => data}
  ProductionOrder.post(pdata, :url => "/production_orders/#{@id}/private_data")
end