agris 0.2.1 → 0.3.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 +4 -4
- data/agris.gemspec +1 -0
- data/lib/agris/api/document_query_response.rb +8 -2
- data/lib/agris/api/grain.rb +4 -0
- data/lib/agris/api/grain/commodity.rb +70 -0
- data/lib/agris/api/grain/commodity_codes.rb +22 -0
- data/lib/agris/api/grain/specific_commodity_code_extract.rb +17 -0
- data/lib/agris/api/messages.rb +4 -0
- data/lib/agris/api/messages/document_query_base.rb +18 -0
- data/lib/agris/api/messages/query_commodity_code_documents.rb +21 -0
- data/lib/agris/api/messages/query_delivery_ticket_documents.rb +1 -9
- data/lib/agris/api/messages/query_invoice_documents.rb +1 -9
- data/lib/agris/api/messages/query_order_documents.rb +1 -9
- data/lib/agris/api/messages/query_purchase_contract_documents.rb +1 -9
- data/lib/agris/client.rb +1 -0
- data/lib/agris/version.rb +1 -1
- data/lib/agris/xml_model.rb +4 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbd46cc8f2b9b4bf6ca1af3e2953f2b7ce26aef6
|
4
|
+
data.tar.gz: b6115cd1b162c8e4e0bab1849a85b1bcbcc61c12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0d6669a41eda7418e5a396766098a0e56e43101f484bb08e527ba4785977ab2a8bdb3e3680e14284b4752ce199e2f3f27a9026e06bbe6971f0001c646c1b7fd
|
7
|
+
data.tar.gz: d13a3daf42827bbc6b4ae50de0c75141519c2796180c3145253c6ba720b79f9e0a9e8a320bb699230e8df38f225e3eef267c9458bd3a7b3ad7bb316d1b131867
|
data/agris.gemspec
CHANGED
@@ -10,7 +10,9 @@ module Agris
|
|
10
10
|
|
11
11
|
def last_request_date_time
|
12
12
|
DateTime.parse(
|
13
|
-
@output_hash[
|
13
|
+
@output_hash[pluralized_resource_name] \
|
14
|
+
['system'] \
|
15
|
+
['lastrequestdatetime']
|
14
16
|
)
|
15
17
|
end
|
16
18
|
|
@@ -35,6 +37,10 @@ module Agris
|
|
35
37
|
.downcase
|
36
38
|
end
|
37
39
|
|
40
|
+
def pluralized_resource_name
|
41
|
+
resource_type.pluralized_name
|
42
|
+
end
|
43
|
+
|
38
44
|
def resource_type
|
39
45
|
@resource_type ||= Object.const_get(
|
40
46
|
self
|
@@ -48,7 +54,7 @@ module Agris
|
|
48
54
|
|
49
55
|
def resources
|
50
56
|
# Wrap and flatten for single responses
|
51
|
-
[@output_hash[
|
57
|
+
[@output_hash[pluralized_resource_name][resource_name]]
|
52
58
|
.compact
|
53
59
|
.flatten
|
54
60
|
end
|
data/lib/agris/api/grain.rb
CHANGED
@@ -2,11 +2,15 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Grain
|
5
|
+
autoload :Commodity, 'agris/api/grain/commodity'
|
6
|
+
autoload :CommodityCodes, 'agris/api/grain/commodity_codes'
|
5
7
|
autoload :Contract, 'agris/api/grain/contract'
|
6
8
|
autoload :PurchaseContracts, 'agris/api/grain/purchase_contracts'
|
7
9
|
autoload :NewTicket, 'agris/api/grain/new_ticket'
|
8
10
|
autoload :NewTicketApplication, 'agris/api/grain/new_ticket_application'
|
9
11
|
autoload :NewTicketRemark, 'agris/api/grain/new_ticket_remark'
|
12
|
+
autoload :SpecificCommodityCodeExtract,
|
13
|
+
'agris/api/grain/specific_commodity_code_extract'
|
10
14
|
autoload :SpecificPurchaseContractExtract,
|
11
15
|
'agris/api/grain/specific_purchase_contract_extract'
|
12
16
|
autoload :Tickets,
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Agris
|
3
|
+
module Api
|
4
|
+
module Grain
|
5
|
+
class Commodity
|
6
|
+
include XmlModel
|
7
|
+
|
8
|
+
def self.pluralized_name
|
9
|
+
'commodities'
|
10
|
+
end
|
11
|
+
|
12
|
+
ATTRIBUTE_NAMES = %w(
|
13
|
+
unique_id
|
14
|
+
integration_guid
|
15
|
+
location
|
16
|
+
location_description
|
17
|
+
code
|
18
|
+
code_description
|
19
|
+
dpr_by_variety_class
|
20
|
+
buy_sell_uom_code
|
21
|
+
buy_sell_uom
|
22
|
+
inv_buy_sell_uom_code
|
23
|
+
inv_buy_sell_uom_code_desc
|
24
|
+
position_uom
|
25
|
+
ledger_uom
|
26
|
+
buy_sell_weight_factor
|
27
|
+
position_weight_factor
|
28
|
+
ledger_weight_factor
|
29
|
+
status
|
30
|
+
status_description
|
31
|
+
hedgeable
|
32
|
+
valid_future_month
|
33
|
+
nearby_future_month
|
34
|
+
default_future_month
|
35
|
+
default_board_name
|
36
|
+
inbound_freight_account
|
37
|
+
inbound_freight_account_desc
|
38
|
+
outbound_freight_account
|
39
|
+
outbound_freight_account_desc
|
40
|
+
ar_invoice_type
|
41
|
+
ar_invoice_type_desc
|
42
|
+
position_report_field_1
|
43
|
+
position_report_field_2
|
44
|
+
ap_voucher_type
|
45
|
+
ap_voucher_type_desc
|
46
|
+
taxable_1
|
47
|
+
taxable_2
|
48
|
+
taxable_3
|
49
|
+
taxable_4
|
50
|
+
inbound_adjust_prcnt
|
51
|
+
outbound_adjust_prcnt
|
52
|
+
minimum_price
|
53
|
+
maximum_price
|
54
|
+
cash_price
|
55
|
+
cash_basis
|
56
|
+
freight_tax_percent
|
57
|
+
hedge_percent
|
58
|
+
uom_product_group
|
59
|
+
uom_product_group_description
|
60
|
+
delete
|
61
|
+
lastchangedatetime
|
62
|
+
last_change_user_id
|
63
|
+
last_change_user_name
|
64
|
+
).freeze
|
65
|
+
|
66
|
+
attr_reader(*ATTRIBUTE_NAMES)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Agris
|
3
|
+
module Api
|
4
|
+
module Grain
|
5
|
+
module CommodityCodes
|
6
|
+
def commodity_code(location, code)
|
7
|
+
extract = Agris::Api::Grain::SpecificCommodityCodeExtract
|
8
|
+
.new(location, code)
|
9
|
+
|
10
|
+
commodity_codes([extract])
|
11
|
+
end
|
12
|
+
|
13
|
+
def commodity_codes(extracts)
|
14
|
+
extract_documents(
|
15
|
+
Messages::QueryCommodityCodeDocuments.new(extracts),
|
16
|
+
Agris::Api::Grain::Commodity
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Agris
|
3
|
+
module Api
|
4
|
+
module Grain
|
5
|
+
class SpecificCommodityCodeExtract
|
6
|
+
include ::Agris::XmlModel
|
7
|
+
|
8
|
+
attr_accessor :location, :code
|
9
|
+
|
10
|
+
def initialize(location, code)
|
11
|
+
@location = location
|
12
|
+
@code = code
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/agris/api/messages.rb
CHANGED
@@ -2,12 +2,16 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
+
autoload :DocumentQueryBase,
|
6
|
+
'agris/api/messages/document_query_base'
|
5
7
|
autoload :MessageBase,
|
6
8
|
'agris/api/messages/message_base'
|
7
9
|
autoload :Import,
|
8
10
|
'agris/api/messages/import'
|
9
11
|
autoload :QueryBase,
|
10
12
|
'agris/api/messages/query_base'
|
13
|
+
autoload :QueryCommodityCodeDocuments,
|
14
|
+
'agris/api/messages/query_commodity_code_documents'
|
11
15
|
autoload :QueryChangedDeliveryTickets,
|
12
16
|
'agris/api/messages/query_changed_delivery_tickets'
|
13
17
|
autoload :QueryChangedPurchaseContracts,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Agris
|
3
|
+
module Api
|
4
|
+
module Messages
|
5
|
+
class DocumentQueryBase < QueryBase
|
6
|
+
def initialize(document_references)
|
7
|
+
@document_references = document_references
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def input_hash
|
13
|
+
input_base_hash
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Agris
|
3
|
+
module Api
|
4
|
+
module Messages
|
5
|
+
class QueryCommodityCodeDocuments < DocumentQueryBase
|
6
|
+
def message_number
|
7
|
+
81_300
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def xml_hash
|
13
|
+
xml_base_hash
|
14
|
+
.merge(
|
15
|
+
commodity: @document_references.map(&:to_xml_hash)
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -2,21 +2,13 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
-
class QueryDeliveryTicketDocuments <
|
6
|
-
def initialize(document_references)
|
7
|
-
@document_references = document_references
|
8
|
-
end
|
9
|
-
|
5
|
+
class QueryDeliveryTicketDocuments < DocumentQueryBase
|
10
6
|
def message_number
|
11
7
|
80_600
|
12
8
|
end
|
13
9
|
|
14
10
|
protected
|
15
11
|
|
16
|
-
def input_hash
|
17
|
-
input_base_hash
|
18
|
-
end
|
19
|
-
|
20
12
|
def xml_hash
|
21
13
|
xml_base_hash
|
22
14
|
.merge(
|
@@ -2,21 +2,13 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
-
class QueryInvoiceDocuments <
|
6
|
-
def initialize(document_references)
|
7
|
-
@document_references = document_references
|
8
|
-
end
|
9
|
-
|
5
|
+
class QueryInvoiceDocuments < DocumentQueryBase
|
10
6
|
def message_number
|
11
7
|
80_500
|
12
8
|
end
|
13
9
|
|
14
10
|
protected
|
15
11
|
|
16
|
-
def input_hash
|
17
|
-
input_base_hash
|
18
|
-
end
|
19
|
-
|
20
12
|
def xml_hash
|
21
13
|
xml_base_hash
|
22
14
|
.merge(
|
@@ -2,21 +2,13 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
-
class QueryOrderDocuments <
|
6
|
-
def initialize(document_references)
|
7
|
-
@document_references = document_references
|
8
|
-
end
|
9
|
-
|
5
|
+
class QueryOrderDocuments < DocumentQueryBase
|
10
6
|
def message_number
|
11
7
|
80_900
|
12
8
|
end
|
13
9
|
|
14
10
|
protected
|
15
11
|
|
16
|
-
def input_hash
|
17
|
-
input_base_hash
|
18
|
-
end
|
19
|
-
|
20
12
|
def xml_hash
|
21
13
|
xml_base_hash
|
22
14
|
.merge(
|
@@ -2,21 +2,13 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
-
class QueryPurchaseContractDocuments <
|
6
|
-
def initialize(document_references)
|
7
|
-
@document_references = document_references
|
8
|
-
end
|
9
|
-
|
5
|
+
class QueryPurchaseContractDocuments < DocumentQueryBase
|
10
6
|
def message_number
|
11
7
|
80_150
|
12
8
|
end
|
13
9
|
|
14
10
|
protected
|
15
11
|
|
16
|
-
def input_hash
|
17
|
-
input_base_hash
|
18
|
-
end
|
19
|
-
|
20
12
|
def xml_hash
|
21
13
|
xml_base_hash
|
22
14
|
.merge(
|
data/lib/agris/client.rb
CHANGED
data/lib/agris/version.rb
CHANGED
data/lib/agris/xml_model.rb
CHANGED
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.
|
4
|
+
version: 0.3.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-
|
12
|
+
date: 2018-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '2.3'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: pry-byebug
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
112
126
|
description:
|
113
127
|
email:
|
114
128
|
- wopr42@gmail.com
|
@@ -138,11 +152,14 @@ files:
|
|
138
152
|
- lib/agris/api/accounts_receivables/specific_invoice_extract.rb
|
139
153
|
- lib/agris/api/document_query_response.rb
|
140
154
|
- lib/agris/api/grain.rb
|
155
|
+
- lib/agris/api/grain/commodity.rb
|
156
|
+
- lib/agris/api/grain/commodity_codes.rb
|
141
157
|
- lib/agris/api/grain/contract.rb
|
142
158
|
- lib/agris/api/grain/new_ticket.rb
|
143
159
|
- lib/agris/api/grain/new_ticket_application.rb
|
144
160
|
- lib/agris/api/grain/new_ticket_remark.rb
|
145
161
|
- lib/agris/api/grain/purchase_contracts.rb
|
162
|
+
- lib/agris/api/grain/specific_commodity_code_extract.rb
|
146
163
|
- lib/agris/api/grain/specific_purchase_contract_extract.rb
|
147
164
|
- lib/agris/api/grain/tickets.rb
|
148
165
|
- lib/agris/api/inventory.rb
|
@@ -153,6 +170,7 @@ files:
|
|
153
170
|
- lib/agris/api/inventory/specific_delivery_ticket_extract.rb
|
154
171
|
- lib/agris/api/inventory/specific_order_extract.rb
|
155
172
|
- lib/agris/api/messages.rb
|
173
|
+
- lib/agris/api/messages/document_query_base.rb
|
156
174
|
- lib/agris/api/messages/import.rb
|
157
175
|
- lib/agris/api/messages/message_base.rb
|
158
176
|
- lib/agris/api/messages/query_base.rb
|
@@ -160,6 +178,7 @@ files:
|
|
160
178
|
- lib/agris/api/messages/query_changed_invoices.rb
|
161
179
|
- lib/agris/api/messages/query_changed_orders.rb
|
162
180
|
- lib/agris/api/messages/query_changed_purchase_contracts.rb
|
181
|
+
- lib/agris/api/messages/query_commodity_code_documents.rb
|
163
182
|
- lib/agris/api/messages/query_delivery_ticket_documents.rb
|
164
183
|
- lib/agris/api/messages/query_invoice_documents.rb
|
165
184
|
- lib/agris/api/messages/query_order_documents.rb
|