agris 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound-rubocop.yml +14 -10
- data/.rubocop.yml +11 -2
- data/agris.gemspec +3 -4
- data/lib/agris.rb +1 -1
- data/lib/agris/api/document_query_response.rb +3 -4
- data/lib/agris/api/inventory/delivery_tickets.rb +2 -2
- data/lib/agris/api/inventory/orders.rb +2 -2
- data/lib/agris/api/messages.rb +2 -0
- data/lib/agris/api/messages/changed_query_base.rb +27 -0
- data/lib/agris/api/messages/query_changed_delivery_tickets.rb +1 -16
- data/lib/agris/api/messages/query_changed_invoices.rb +1 -18
- data/lib/agris/api/messages/query_changed_orders.rb +1 -16
- data/lib/agris/api/messages/query_changed_purchase_contracts.rb +1 -18
- data/lib/agris/process_message_response.rb +1 -1
- data/lib/agris/savon_request.rb +6 -6
- data/lib/agris/version.rb +1 -1
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64629354ccada6a381efe8aa942ced5079b6ee4d
|
4
|
+
data.tar.gz: ab9f6e49adf01f310a25d30c2677cd96fb6da522
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18d1d0e8345d9b2c425a279a3f88e32ada1a3708b10b6d5af134a6699398138b8b7b0e1e23bb176ca8a5b3e824601db4d7a683e8c83d9aec323ee8576275d163
|
7
|
+
data.tar.gz: 6d4b4e8dc43c3b70975fac6e87e829e350f6df6592fc3d7ad4595753bfabd81feac412665a3d47f4d2130bea212081d8fa5d355f3fc0f3080ee275243e770aba
|
data/.hound-rubocop.yml
CHANGED
@@ -29,7 +29,7 @@ Style/CollectionMethods:
|
|
29
29
|
find: detect
|
30
30
|
find_all: select
|
31
31
|
reduce: inject
|
32
|
-
|
32
|
+
Naming/FileName:
|
33
33
|
Description: Use snake_case for source file names.
|
34
34
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
|
35
35
|
Enabled: false
|
@@ -43,7 +43,6 @@ Style/IfUnlessModifier:
|
|
43
43
|
Description: Favor modifier if/unless usage when you have a single-line body.
|
44
44
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
|
45
45
|
Enabled: false
|
46
|
-
MaxLineLength: 80
|
47
46
|
Style/OptionHash:
|
48
47
|
Description: Don't use option hashes when you can use keyword arguments.
|
49
48
|
Enabled: false
|
@@ -61,7 +60,7 @@ Style/PercentLiteralDelimiters:
|
|
61
60
|
"%w": "()"
|
62
61
|
"%W": "()"
|
63
62
|
"%x": "()"
|
64
|
-
|
63
|
+
Naming/PredicateName:
|
65
64
|
Description: Check the names of predicate methods.
|
66
65
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
67
66
|
Enabled: true
|
@@ -84,7 +83,7 @@ Style/RaiseArgs:
|
|
84
83
|
Style/SignalException:
|
85
84
|
Description: Checks for proper usage of fail and raise.
|
86
85
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
|
87
|
-
Enabled:
|
86
|
+
Enabled: true
|
88
87
|
EnforcedStyle: semantic
|
89
88
|
SupportedStyles:
|
90
89
|
- only_raise
|
@@ -125,12 +124,17 @@ Style/StringLiteralsInInterpolation:
|
|
125
124
|
Style/TrailingCommaInArguments:
|
126
125
|
Description: 'Checks for trailing comma in argument lists.'
|
127
126
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
128
|
-
Enabled:
|
127
|
+
Enabled: true
|
129
128
|
EnforcedStyleForMultiline: no_comma
|
130
|
-
Style/
|
131
|
-
Description: 'Checks for trailing comma in array
|
129
|
+
Style/TrailingCommaInArrayLiteral:
|
130
|
+
Description: 'Checks for trailing comma in array literals.'
|
132
131
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
133
|
-
Enabled:
|
132
|
+
Enabled: true
|
133
|
+
EnforcedStyleForMultiline: no_comma
|
134
|
+
Style/TrailingCommaInHashLiteral:
|
135
|
+
Description: 'Checks for trailing comma in hash literals.'
|
136
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
137
|
+
Enabled: true
|
134
138
|
EnforcedStyleForMultiline: no_comma
|
135
139
|
Metrics/AbcSize:
|
136
140
|
Description: A calculated magnitude based on number of assignments, branches, and
|
@@ -177,7 +181,7 @@ Lint/AssignmentInCondition:
|
|
177
181
|
Style/InlineComment:
|
178
182
|
Description: Avoid inline comments.
|
179
183
|
Enabled: false
|
180
|
-
|
184
|
+
Naming/AccessorMethodName:
|
181
185
|
Description: Check the naming of accessor methods for get_/set_.
|
182
186
|
Enabled: false
|
183
187
|
Style/Alias:
|
@@ -235,7 +239,7 @@ Lint/HandleExceptions:
|
|
235
239
|
Description: Don't suppress exception.
|
236
240
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
|
237
241
|
Enabled: false
|
238
|
-
Lint/
|
242
|
+
Lint/LiteralAsCondition:
|
239
243
|
Description: Checks of literals used in conditions.
|
240
244
|
Enabled: false
|
241
245
|
Lint/LiteralInInterpolation:
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
-
inherit_from:
|
1
|
+
inherit_from:
|
2
|
+
- .hound-rubocop.yml
|
2
3
|
|
4
|
+
Rails:
|
5
|
+
Enabled: false
|
3
6
|
AllCops:
|
4
|
-
TargetRubyVersion: 2.
|
7
|
+
TargetRubyVersion: 2.4
|
5
8
|
Exclude:
|
9
|
+
- "vendor/**/*"
|
10
|
+
- "db/schema.rb"
|
11
|
+
- "node_modules/**/*"
|
6
12
|
- bin/*
|
7
13
|
Layout/DotPosition:
|
8
14
|
Description: Checks the position of the dot in multi-line method calls.
|
@@ -38,3 +44,6 @@ Style/StringLiterals:
|
|
38
44
|
SupportedStyles:
|
39
45
|
- single_quotes
|
40
46
|
- double_quotes
|
47
|
+
Rails/DynamicFindBy:
|
48
|
+
Exclude:
|
49
|
+
- "spec/features/**/*"
|
data/agris.gemspec
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
|
-
lib = File.expand_path('
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
4
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
4
|
require 'agris/version'
|
6
5
|
|
@@ -24,10 +23,10 @@ Gem::Specification.new do |spec|
|
|
24
23
|
spec.add_dependency 'savon', '~> 2.11'
|
25
24
|
|
26
25
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
26
|
+
spec.add_development_dependency 'pry-byebug'
|
27
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
-
spec.add_development_dependency 'rubocop', '0.
|
29
|
+
spec.add_development_dependency 'rubocop', '0.54.0'
|
30
30
|
spec.add_development_dependency 'simplecov'
|
31
31
|
spec.add_development_dependency 'webmock', '~> 2.3'
|
32
|
-
spec.add_development_dependency 'pry-byebug'
|
33
32
|
end
|
data/lib/agris.rb
CHANGED
@@ -4,12 +4,12 @@ module Agris
|
|
4
4
|
class DocumentQueryResponse
|
5
5
|
def initialize(output_hash, resource_type = nil)
|
6
6
|
@output_hash = output_hash
|
7
|
-
@
|
7
|
+
@documents = nil
|
8
8
|
@resource_type = resource_type if resource_type
|
9
9
|
end
|
10
10
|
|
11
11
|
def last_request_date_time
|
12
|
-
|
12
|
+
Time.parse(
|
13
13
|
@output_hash[pluralized_resource_name] \
|
14
14
|
['system'] \
|
15
15
|
['lastrequestdatetime']
|
@@ -17,7 +17,7 @@ module Agris
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def documents
|
20
|
-
@
|
20
|
+
@documents ||= parse
|
21
21
|
end
|
22
22
|
|
23
23
|
protected
|
@@ -61,4 +61,3 @@ module Agris
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
-
# rubocop:enable Rails/TimeZone
|
@@ -18,9 +18,9 @@ module Agris
|
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
21
|
-
def delivery_tickets_changed_since(datetime)
|
21
|
+
def delivery_tickets_changed_since(datetime, detail = false)
|
22
22
|
extract_documents(
|
23
|
-
Messages::QueryChangedDeliveryTickets.new(datetime),
|
23
|
+
Messages::QueryChangedDeliveryTickets.new(datetime, detail),
|
24
24
|
DeliveryTicket
|
25
25
|
)
|
26
26
|
end
|
@@ -28,9 +28,9 @@ module Agris
|
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
31
|
-
def orders_changed_since(datetime)
|
31
|
+
def orders_changed_since(datetime, detail = false)
|
32
32
|
extract_documents(
|
33
|
-
Messages::QueryChangedOrders.new(datetime),
|
33
|
+
Messages::QueryChangedOrders.new(datetime, detail),
|
34
34
|
Agris::Api::Order
|
35
35
|
)
|
36
36
|
end
|
data/lib/agris/api/messages.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Agris
|
3
|
+
module Api
|
4
|
+
module Messages
|
5
|
+
class ChangedQueryBase < QueryBase
|
6
|
+
def initialize(time, detail)
|
7
|
+
@time = time
|
8
|
+
@detail = detail
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
def input_hash
|
14
|
+
input_base_hash
|
15
|
+
.merge(
|
16
|
+
:@details => @detail,
|
17
|
+
locid: {
|
18
|
+
:@datetime => @time.strftime('%Y-%m-%dT%H:%M:%S'),
|
19
|
+
:@id => nil,
|
20
|
+
:@loccode => nil
|
21
|
+
}
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -2,28 +2,13 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
-
class QueryChangedDeliveryTickets <
|
6
|
-
def initialize(time)
|
7
|
-
@time = time
|
8
|
-
end
|
9
|
-
|
5
|
+
class QueryChangedDeliveryTickets < ChangedQueryBase
|
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
|
-
.merge(
|
19
|
-
locid: {
|
20
|
-
:@datetime => @time.strftime('%Y-%m-%dT%H:%M:%S'),
|
21
|
-
:@id => nil,
|
22
|
-
:@loccode => nil
|
23
|
-
}
|
24
|
-
)
|
25
|
-
end
|
26
|
-
|
27
12
|
def xml_hash
|
28
13
|
xml_base_hash
|
29
14
|
.merge(
|
@@ -2,30 +2,13 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
-
class QueryChangedInvoices <
|
6
|
-
def initialize(time, detail)
|
7
|
-
@time = time
|
8
|
-
@detail = detail
|
9
|
-
end
|
10
|
-
|
5
|
+
class QueryChangedInvoices < ChangedQueryBase
|
11
6
|
def message_number
|
12
7
|
80_500
|
13
8
|
end
|
14
9
|
|
15
10
|
protected
|
16
11
|
|
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
12
|
def xml_hash
|
30
13
|
xml_base_hash
|
31
14
|
.merge(
|
@@ -2,28 +2,13 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
-
class QueryChangedOrders <
|
6
|
-
def initialize(time)
|
7
|
-
@time = time
|
8
|
-
end
|
9
|
-
|
5
|
+
class QueryChangedOrders < ChangedQueryBase
|
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
|
-
.merge(
|
19
|
-
locid: {
|
20
|
-
:@datetime => @time.strftime('%Y-%m-%dT%H:%M:%S'),
|
21
|
-
:@id => nil,
|
22
|
-
:@loccode => nil
|
23
|
-
}
|
24
|
-
)
|
25
|
-
end
|
26
|
-
|
27
12
|
def xml_hash
|
28
13
|
xml_base_hash
|
29
14
|
.merge(
|
@@ -2,30 +2,13 @@
|
|
2
2
|
module Agris
|
3
3
|
module Api
|
4
4
|
module Messages
|
5
|
-
class QueryChangedPurchaseContracts <
|
6
|
-
def initialize(time, detail)
|
7
|
-
@time = time
|
8
|
-
@detail = detail
|
9
|
-
end
|
10
|
-
|
5
|
+
class QueryChangedPurchaseContracts < ChangedQueryBase
|
11
6
|
def message_number
|
12
7
|
80_150
|
13
8
|
end
|
14
9
|
|
15
10
|
protected
|
16
11
|
|
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
12
|
def xml_hash
|
30
13
|
xml_base_hash
|
31
14
|
end
|
data/lib/agris/savon_request.rb
CHANGED
@@ -17,7 +17,7 @@ module Agris
|
|
17
17
|
message: {
|
18
18
|
AgContext_str_p: context,
|
19
19
|
AgMessage_int_p: message_number,
|
20
|
-
AgInput_obj_p: input
|
20
|
+
AgInput_obj_p: input
|
21
21
|
}
|
22
22
|
)
|
23
23
|
message_response = parse_response(response)
|
@@ -56,17 +56,17 @@ module Agris
|
|
56
56
|
def response_error(error_info)
|
57
57
|
Object.const_get(
|
58
58
|
format(
|
59
|
-
'Agris
|
60
|
-
error_info.type.to_s.split('_').map(&:capitalize).join
|
59
|
+
'Agris::%<error_name>sError',
|
60
|
+
error_name: error_info.type.to_s.split('_').map(&:capitalize).join
|
61
61
|
)
|
62
62
|
).new(error_info.payload)
|
63
63
|
end
|
64
64
|
|
65
65
|
def wsdl
|
66
66
|
format(
|
67
|
-
'
|
68
|
-
@base_url,
|
69
|
-
'agris/AGRIS.Env.MessageRouter/AGRIS.Env.MessageRouter.asmx?WSDL'
|
67
|
+
'%<base_url>s/%<path>s',
|
68
|
+
base_url: @base_url,
|
69
|
+
path: 'agris/AGRIS.Env.MessageRouter/AGRIS.Env.MessageRouter.asmx?WSDL'
|
70
70
|
)
|
71
71
|
end
|
72
72
|
end
|
data/lib/agris/version.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.3.
|
4
|
+
version: 0.3.1
|
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-05-
|
12
|
+
date: 2018-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -39,6 +39,20 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.14'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: pry-byebug
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: rake
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +87,14 @@ dependencies:
|
|
73
87
|
requirements:
|
74
88
|
- - '='
|
75
89
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
90
|
+
version: 0.54.0
|
77
91
|
type: :development
|
78
92
|
prerelease: false
|
79
93
|
version_requirements: !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
95
|
- - '='
|
82
96
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
97
|
+
version: 0.54.0
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: simplecov
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,20 +123,6 @@ dependencies:
|
|
109
123
|
- - "~>"
|
110
124
|
- !ruby/object:Gem::Version
|
111
125
|
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'
|
126
126
|
description:
|
127
127
|
email:
|
128
128
|
- wopr42@gmail.com
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- lib/agris/api/inventory/specific_delivery_ticket_extract.rb
|
171
171
|
- lib/agris/api/inventory/specific_order_extract.rb
|
172
172
|
- lib/agris/api/messages.rb
|
173
|
+
- lib/agris/api/messages/changed_query_base.rb
|
173
174
|
- lib/agris/api/messages/document_query_base.rb
|
174
175
|
- lib/agris/api/messages/import.rb
|
175
176
|
- lib/agris/api/messages/message_base.rb
|