Class: Elmas::GoodsDeliveryLine

Inherits:
Object
  • Object
show all
Includes:
Resource, SharedSalesAttributes
Defined in:
lib/elmas/resources/goods_delivery_line.rb

Constant Summary

Constants included from SharedSalesAttributes

SharedSalesAttributes::SHARED_LINE_ATTRIBUTES, SharedSalesAttributes::SHARED_SALES_ATTRIBUTES

Instance Attribute Summary

Attributes included from Resource

#attributes, #response, #url

Instance Method Summary collapse

Methods included from Resource

#delete, #find, #find_by, #get, #id, #id?, #initialize, #method_missing, #save, #valid?

Methods included from Resource::Sanitizer

#sanitize, #sanitize_date_time, #sanitize_has_many, #sanitize_relationship

Methods included from Resource::UriMethods

#apply_filters, #apply_order, #apply_select, #base_filter, #basic_identifier_uri, #query_attribute, #sanitize_value, #uri

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Elmas::Resource

Instance Method Details

#base_pathObject



17
18
19
# File 'lib/elmas/resources/goods_delivery_line.rb', line 17

def base_path
  "salesorder/GoodsDeliveryLines"
end

#find_all(options = {}) ⇒ Object

For some reason the Exact API for GoodsDelivery requires us to specify the fields we want returned. This isn’t required for other calls. :/ We get around this by specifying a wildcard on the $select param.



10
11
12
13
14
15
# File 'lib/elmas/resources/goods_delivery_line.rb', line 10

def find_all(options = {})
  @order_by = options[:order_by]
  @select = options[:select] ||= ['*']
  response = get(uri([:order, :select]))
  response.results if response
end

#mandatory_attributesObject



21
22
23
# File 'lib/elmas/resources/goods_delivery_line.rb', line 21

def mandatory_attributes
  [:delivery_date, :item, :line_number, :sales_order_number]
end

#other_attributesObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elmas/resources/goods_delivery_line.rb', line 25

def other_attributes
  SHARED_LINE_ATTRIBUTES.inject(
    [
      :quantity_delivered, :quantity_ordered,
      :sales_order_line_id, :sales_order_line_number,
      :serial_numbers, :storage_location,
      :tracking_number, :unit_code
    ],
    :<<
  )
end