Class: Eol::GoodsDelivery

Inherits:
Object
  • Object
show all
Includes:
Resource, SharedSalesAttributes
Defined in:
lib/eol/resources/goods_delivery.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 Eol::Resource

Instance Method Details

#base_pathObject



16
17
18
# File 'lib/eol/resources/goods_delivery.rb', line 16

def base_path
  "salesorder/GoodsDeliveries"
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.



9
10
11
12
13
14
# File 'lib/eol/resources/goods_delivery.rb', line 9

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

#mandatory_attributesObject



20
21
22
# File 'lib/eol/resources/goods_delivery.rb', line 20

def mandatory_attributes
  [:goods_delivery_lines]
end

#other_attributesObject



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

def other_attributes
  SHARED_SALES_ATTRIBUTES.inject(
    [
      :delivery_account, :delivery_account_code, :delivery_account_name,
      :delivery_address, :delivery_contact, :delivery_contact_person_full_name,
      :delivery_date, :delivery_number,
      :shipping_method, :shipping_method_code, :shipping_method_description,
      :tracking_number, :warehouse, :warehouse_code, :warehouse_description
    ],
    :<<
  )
end