reso_transport 1.5.16 → 1.5.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/reso_transport/query.rb +23 -3
- data/lib/reso_transport/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b3402fbb54b2def806edab7eb86c501b511979ba7f9c91565fec9350cc30fa7
|
4
|
+
data.tar.gz: 84f6931f9ac9c8d7e42e46abc5b3bdf7d8116493fe128550b55b7192589b4e41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98b3df1517d3bf82d7ff2d6d764ac840c9773cae1ee3a098d126250a5fdcfd9651827268fe20a7fec5d729438f1ce211856b3ba39595a2cdba358cd2105c7d96
|
7
|
+
data.tar.gz: ffcf28ea52fd5959bdf5b702466ea015a028eac746d7ed50888a948494cf8e89b968410dd4b068a4bfe0582c78fab8d4586f551a2a2b06e0cc3653fc2d0cf833
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
reso_transport (1.5.
|
4
|
+
reso_transport (1.5.18)
|
5
5
|
faraday (~> 1.0.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
minitest (5.13.0)
|
14
14
|
minitest-rg (5.2.0)
|
15
15
|
minitest (~> 5.0)
|
16
|
-
multipart-post (2.
|
16
|
+
multipart-post (2.2.3)
|
17
17
|
rake (13.0.1)
|
18
18
|
vcr (6.0.0)
|
19
19
|
|
data/lib/reso_transport/query.rb
CHANGED
@@ -23,6 +23,11 @@ module ResoTransport
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
def set_query_params(params)
|
27
|
+
query_parameters.merge!(params)
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
26
31
|
def limit(size)
|
27
32
|
options[:top] = size
|
28
33
|
self
|
@@ -70,23 +75,33 @@ module ResoTransport
|
|
70
75
|
|
71
76
|
def results
|
72
77
|
parsed = handle_response response
|
73
|
-
|
74
78
|
@next_link = parsed.fetch('@odata.nextLink', nil)
|
75
79
|
results = Array(parsed.delete('value'))
|
76
80
|
resource.parse(results)
|
77
81
|
end
|
78
82
|
|
79
|
-
# Can only be accessed after results call
|
83
|
+
# Can only be accessed after results call or if it's being set
|
80
84
|
def next_link
|
81
85
|
@next_link
|
82
86
|
end
|
83
87
|
|
88
|
+
# used for setting the next_link with trestle's replication strategy
|
89
|
+
def next_link=(link)
|
90
|
+
@next_link = link
|
91
|
+
end
|
92
|
+
|
84
93
|
def response
|
85
|
-
|
94
|
+
next_link_or_params = use_next_link? ? next_link : compile_params
|
95
|
+
|
96
|
+
resource.get(next_link_or_params)
|
86
97
|
rescue Faraday::ConnectionFailed
|
87
98
|
raise NoResponse.new(resource.request, nil, resource)
|
88
99
|
end
|
89
100
|
|
101
|
+
def use_next_link?
|
102
|
+
compile_params[:replication] && next_link.present?
|
103
|
+
end
|
104
|
+
|
90
105
|
def handle_response(response)
|
91
106
|
raise RequestError.new(resource.request, response, resource) unless response.success?
|
92
107
|
|
@@ -116,6 +131,10 @@ module ResoTransport
|
|
116
131
|
@options ||= {}
|
117
132
|
end
|
118
133
|
|
134
|
+
def query_parameters
|
135
|
+
@query_parameters ||= {}
|
136
|
+
end
|
137
|
+
|
119
138
|
def sub_queries
|
120
139
|
@sub_queries ||= Hash.new { |h, k| h[k] = { context: 'and', criteria: [] } }
|
121
140
|
end
|
@@ -144,6 +163,7 @@ module ResoTransport
|
|
144
163
|
end
|
145
164
|
|
146
165
|
params['$filter'] = compile_filters unless sub_queries.empty?
|
166
|
+
params.merge!(query_parameters) unless query_parameters.empty?
|
147
167
|
|
148
168
|
params
|
149
169
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reso_transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Druse
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|