agris 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4d090ac08f37e8b68e3c5573667111b9f42f1b7
4
- data.tar.gz: 2bb7298c5c672b810b2c35c50c0be3dd205660dc
3
+ metadata.gz: 573d8c7bf0c49cb4597b123c9491b8dbe43bae96
4
+ data.tar.gz: 5253979760217d159c16f166fdabac7af7052833
5
5
  SHA512:
6
- metadata.gz: 21762b562cff9392c8976854e4b3c52dab34b00f2900ac764b93dddd16f38a585baba01e6f11c0b8466a84ec1e90bf4a83fc4d259ac59078ec34b77e0bdb2b4c
7
- data.tar.gz: 2dce9ba1d5a2f50502c091da42a3372c8c4593b5165681c45d5aca1dec5a08ce91b826562ddac2c0a9d571857d3567fd87975333b4d4db9b5e0a89928d98826c
6
+ metadata.gz: 1854d4f85d5d046aa857a665673f6e3f8b6ef2f7ed81b20935a56c9e5a6dcdddbe9b00a38f8bf5c63f2152ee7f5f2796cb7fef5e444303115fc2966a97edfa53
7
+ data.tar.gz: 3bb8d7f6ea064eae4224d0b0177730050a2cf80eda7c2f4a03b44bd038ed94f04787115a378b57d85e49a74796fdae6d12fbb104129745133d2c07cd9f6a09ad
@@ -2,9 +2,13 @@
2
2
  module Agris
3
3
  module Api
4
4
  module Grain
5
+ autoload :Contract, 'agris/api/grain/contract'
6
+ autoload :PurchaseContracts, 'agris/api/grain/purchase_contracts'
5
7
  autoload :NewTicket, 'agris/api/grain/new_ticket'
6
8
  autoload :NewTicketApplication, 'agris/api/grain/new_ticket_application'
7
9
  autoload :NewTicketRemark, 'agris/api/grain/new_ticket_remark'
10
+ autoload :SpecificPurchaseContractExtract,
11
+ 'agris/api/grain/specific_purchase_contract_extract'
8
12
  autoload :Tickets,
9
13
  'agris/api/grain/tickets'
10
14
  end
@@ -0,0 +1,225 @@
1
+ # frozen_string_literal: true
2
+ module Agris
3
+ module Api
4
+ module Grain
5
+ class Contract
6
+ include XmlModel
7
+
8
+ ATTRIBUTE_NAMES = %w(
9
+ contract_location
10
+ contract_number
11
+ date_written
12
+ integration_guid
13
+ purchase_sales
14
+ purchase_sales_description
15
+ contract_location_description
16
+ contract_name_id
17
+ contract_name_description
18
+ contract_type
19
+ unique_id
20
+ contract_type_description
21
+ status
22
+ status_description
23
+ signed
24
+ commodity
25
+ commodity_description
26
+ class
27
+ variety
28
+ transport_mode
29
+ transport_description
30
+ external_contract_no
31
+ delivery_terms
32
+ advance_percent
33
+ contract_loads
34
+ applied_loads
35
+ remaining_loads
36
+ contract_quantity
37
+ applied_quantity
38
+ remaining_quantity
39
+ ordered_quantity
40
+ unordered_quantity
41
+ uom
42
+ uom_description
43
+ dp_table
44
+ dp_table_description
45
+ invoice_terms
46
+ invoice_terms_description
47
+ quantity_base
48
+ quantity_base_description
49
+ weight_base
50
+ weight_base_description
51
+ grade_base
52
+ grade_base_description
53
+ ship_to_from_id
54
+ ship_to_from_description
55
+ misc_id
56
+ misc_description
57
+ agent_broker_id
58
+ agent_broker_description
59
+ qty_uom
60
+ qty_uom_description
61
+ last_change_datetime
62
+ delete
63
+ last_change_user_id
64
+ last_change_username
65
+ ).freeze
66
+
67
+ attr_reader(*(%w(schedules) + ATTRIBUTE_NAMES))
68
+
69
+ def self.from_xml_hash(hash)
70
+ super.tap do |document|
71
+ if hash['schedules']
72
+ document.schedules.concat(
73
+ [hash['schedules']['schedule']]
74
+ .flatten
75
+ .map do |schedule|
76
+ Schedule.from_xml_hash(schedule)
77
+ end
78
+ )
79
+ end
80
+ end
81
+ end
82
+
83
+ def initialize(hash = {})
84
+ super
85
+
86
+ @schedules = []
87
+ end
88
+
89
+ class Schedule
90
+ include XmlModel
91
+
92
+ ATTRIBUTE_NAMES = %w(
93
+ number
94
+ price_status
95
+ price_status_description
96
+ apply_status
97
+ apply_status_description
98
+ apply_name_id
99
+ apply_name_description
100
+ other_name_id
101
+ other_name_description
102
+ shipper_id
103
+ shipper_description
104
+ delivery_date
105
+ due_date
106
+ pricing_date
107
+ expire_date
108
+ board_name
109
+ futures_month
110
+ spread_from
111
+ spread_type
112
+ spread_type_description
113
+ name_id_type
114
+ name_id_type_description
115
+ scheduled_loads
116
+ applied_loads
117
+ remaining_loads
118
+ scheduled_quantity
119
+ applied_quantity
120
+ remaining_quantity
121
+ settled_quantity
122
+ unsettled_quantity
123
+ ordered_quantity
124
+ unordered_quantity
125
+ contract_price
126
+ futures_price
127
+ basis_price
128
+ freight_price
129
+ brokerage_price
130
+ other_price
131
+ original_schedule_number
132
+ misc_price_1
133
+ misc_price_2
134
+ misc_price_3
135
+ misc_price_4
136
+ misc_price_5
137
+ misc_price_6
138
+ misc_price_7
139
+ misc_price_8
140
+ misc_price_9
141
+ misc_price_10
142
+ misc_price_11
143
+ misc_price_12
144
+ origin_price
145
+ origin_basis
146
+ destination_price
147
+ destination_basis
148
+ inventory_location
149
+ inventory_location_description
150
+ item_number
151
+ item_description
152
+ product_category
153
+ productcategory_description
154
+ state_county
155
+ state_county_description
156
+ defer_canceled_date
157
+ actual_freight_rate
158
+ additional_freight
159
+ pricing_type
160
+ pricing_type_description
161
+ exec_id
162
+ exec_description
163
+ trade_id
164
+ dp_table
165
+ dp_table_description
166
+ schedule_code
167
+ schedule_code_description
168
+ signed
169
+ weight_base
170
+ weight_base_description
171
+ grade_base
172
+ grade_base_description
173
+ ship_to_from_id
174
+ ship_to_from_description
175
+ misc_id
176
+ misc_description
177
+ agent_broker_id
178
+ agent_broker_description
179
+ external_contract_no
180
+ delivery_terms
181
+ advance_percent
182
+ invoice_terms
183
+ invoice_terms_description
184
+ under_fill_tolerance_percent
185
+ over_fill_tolerance_percent
186
+ under_fill_tolerance_units
187
+ over_fill_tolerance_units
188
+ board_description
189
+ price_uom
190
+ price_uom_description
191
+ freight_uom
192
+ freight_uom_description
193
+ price_currency
194
+ price_currency_description
195
+ freight_currency
196
+ freight_currency_description
197
+ basis_uom
198
+ basis_uom_description
199
+ exchange_rate
200
+ exchange_rate_date
201
+ freight_exchange_rate
202
+ freight_exchange_rate_date
203
+ futures_currency
204
+ futures_currency_description
205
+ basis_currency
206
+ basis_currency_description
207
+ basis_exchange_rate
208
+ basis_exchange_rate_date
209
+ futures_exchange_rate
210
+ futures_exchange_rate_date
211
+ futures_uom
212
+ futures_uom_description
213
+ primary_schedule
214
+ option_quantity
215
+ variety
216
+ class
217
+ variety_description
218
+ ).freeze
219
+
220
+ attr_reader(*ATTRIBUTE_NAMES)
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ module Agris
3
+ module Api
4
+ module Grain
5
+ module PurchaseContracts
6
+ def purchase_contract(contract_location, contract_number)
7
+ extract = Agris::Api::Grain::SpecificPurchaseContractExtract
8
+ .new(contract_location, contract_number)
9
+
10
+ purchase_contracts([extract])
11
+ end
12
+
13
+ def purchase_contracts(extracts)
14
+ extract_documents(
15
+ Messages::QueryPurchaseContractDocuments.new(extracts),
16
+ Agris::Api::Grain::Contract
17
+ )
18
+ end
19
+
20
+ def purchase_contracts_changed_since(datetime, detail = false)
21
+ extract_documents(
22
+ Messages::QueryChangedPurchaseContracts.new(datetime, detail),
23
+ Agris::Api::Grain::Contract
24
+ )
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ module Agris
3
+ module Api
4
+ module Grain
5
+ class SpecificPurchaseContractExtract
6
+ include ::Agris::XmlModel
7
+
8
+ attr_accessor :contract_location, :contract_number
9
+
10
+ def initialize(contract_location, contract_number)
11
+ @contract_location = contract_location
12
+ @contract_number = contract_number
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -10,10 +10,14 @@ module Agris
10
10
  'agris/api/messages/query_base'
11
11
  autoload :QueryChangedDeliveryTickets,
12
12
  'agris/api/messages/query_changed_delivery_tickets'
13
+ autoload :QueryChangedPurchaseContracts,
14
+ 'agris/api/messages/query_changed_purchase_contracts'
13
15
  autoload :QueryChangedInvoices,
14
16
  'agris/api/messages/query_changed_invoices'
15
17
  autoload :QueryChangedOrders,
16
18
  'agris/api/messages/query_changed_orders'
19
+ autoload :QueryPurchaseContractDocuments,
20
+ 'agris/api/messages/query_purchase_contract_documents'
17
21
  autoload :QueryDeliveryTicketDocuments,
18
22
  'agris/api/messages/query_delivery_ticket_documents'
19
23
  autoload :QueryInvoiceDocuments,
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ module Agris
3
+ module Api
4
+ module Messages
5
+ class QueryChangedPurchaseContracts < QueryBase
6
+ def initialize(time, detail)
7
+ @time = time
8
+ @detail = detail
9
+ end
10
+
11
+ def message_number
12
+ 80_150
13
+ end
14
+
15
+ protected
16
+
17
+ def input_hash
18
+ input_base_hash
19
+ .merge(
20
+ :@details => @detail,
21
+ locid: {
22
+ :@datetime => @time.strftime('%Y-%m-%dT%H:%M:%S'),
23
+ :@id => nil,
24
+ :@loccode => nil
25
+ }
26
+ )
27
+ end
28
+
29
+ def xml_hash
30
+ xml_base_hash
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ module Agris
3
+ module Api
4
+ module Messages
5
+ class QueryPurchaseContractDocuments < QueryBase
6
+ def initialize(document_references)
7
+ @document_references = document_references
8
+ end
9
+
10
+ def message_number
11
+ 80_150
12
+ end
13
+
14
+ protected
15
+
16
+ def input_hash
17
+ input_base_hash
18
+ end
19
+
20
+ def xml_hash
21
+ xml_base_hash
22
+ .merge(
23
+ contract: @document_references.map(&:to_xml_hash)
24
+ )
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -3,6 +3,7 @@ module Agris
3
3
  class Client
4
4
  include Api::AccountsPayables::Vouchers
5
5
  include Api::AccountsReceivables::Invoices
6
+ include Api::Grain::PurchaseContracts
6
7
  include Api::Grain::Tickets
7
8
  include Api::Inventory::DeliveryTickets
8
9
  include Api::Inventory::Orders
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Agris
3
- VERSION = '0.1.2'
3
+ VERSION = '0.2.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Gray
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-02-06 00:00:00.000000000 Z
12
+ date: 2018-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -138,9 +138,12 @@ files:
138
138
  - lib/agris/api/accounts_receivables/specific_invoice_extract.rb
139
139
  - lib/agris/api/document_query_response.rb
140
140
  - lib/agris/api/grain.rb
141
+ - lib/agris/api/grain/contract.rb
141
142
  - lib/agris/api/grain/new_ticket.rb
142
143
  - lib/agris/api/grain/new_ticket_application.rb
143
144
  - lib/agris/api/grain/new_ticket_remark.rb
145
+ - lib/agris/api/grain/purchase_contracts.rb
146
+ - lib/agris/api/grain/specific_purchase_contract_extract.rb
144
147
  - lib/agris/api/grain/tickets.rb
145
148
  - lib/agris/api/inventory.rb
146
149
  - lib/agris/api/inventory/delivery_ticket.rb
@@ -156,9 +159,11 @@ files:
156
159
  - lib/agris/api/messages/query_changed_delivery_tickets.rb
157
160
  - lib/agris/api/messages/query_changed_invoices.rb
158
161
  - lib/agris/api/messages/query_changed_orders.rb
162
+ - lib/agris/api/messages/query_changed_purchase_contracts.rb
159
163
  - lib/agris/api/messages/query_delivery_ticket_documents.rb
160
164
  - lib/agris/api/messages/query_invoice_documents.rb
161
165
  - lib/agris/api/messages/query_order_documents.rb
166
+ - lib/agris/api/messages/query_purchase_contract_documents.rb
162
167
  - lib/agris/api/new_order.rb
163
168
  - lib/agris/api/new_order_remark.rb
164
169
  - lib/agris/api/new_voucher.rb
@@ -201,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
206
  version: '0'
202
207
  requirements: []
203
208
  rubyforge_project:
204
- rubygems_version: 2.4.8
209
+ rubygems_version: 2.6.14
205
210
  signing_key:
206
211
  specification_version: 4
207
212
  summary: Ruby client library for Agris API