ecoportal-api-graphql 0.3.17 → 0.4.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/.markdownlint.json +4 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +131 -79
- data/ecoportal-api-graphql.gemspec +7 -7
- data/lib/ecoportal/api/common/graphql/auth_service.rb +40 -30
- data/lib/ecoportal/api/common/graphql/client.rb +10 -4
- data/lib/ecoportal/api/common/graphql/http_client.rb +18 -7
- data/lib/ecoportal/api/graphql/fragment.rb +3 -1
- data/lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb +1 -1
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- metadata +12 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 927df3da8239c448be76b32066894a9bb2b8d0aa1f011033da69cf2b7878aa26
|
|
4
|
+
data.tar.gz: 15825f1ab4dc7a5a366d8e504d07a377650422cf8a1e49a5c21494089719ffae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2020d06df814fb28f2b1592d7107d2368ec23eed3731999964202259f7f486dabb7eff70e7105e5c688e02517e1f8784fc09d682a5c0a5f21234a372cd7e8171
|
|
7
|
+
data.tar.gz: d58a1c29ff883c7ea7c26fe931163f9ab4a7b7d81798d69648482bee8d2377fd5866a1b616f264aa530d9dd76c46a812cc51fb2acaaf2f9a61c3614388f3a4eb
|
data/.markdownlint.json
ADDED
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.2.2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,234 +1,286 @@
|
|
|
1
1
|
# Change Log
|
|
2
|
+
|
|
2
3
|
All notable changes to this project will be documented in this file.
|
|
3
4
|
|
|
5
|
+
## ToDo
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- review `path` tracking
|
|
7
|
+
- Add update operation for `ContractorEntity`
|
|
8
|
+
- Add currentOrganization.action
|
|
9
|
+
- Analyse how to "DSL" currentOrganization.action.activities
|
|
10
|
+
- review `path` tracking
|
|
10
11
|
|
|
11
|
-
## [0.
|
|
12
|
+
## [0.4.0] - 2024-08-01
|
|
12
13
|
|
|
13
14
|
### Added
|
|
15
|
+
|
|
14
16
|
### Changed
|
|
17
|
+
|
|
18
|
+
- require `ruby 3`
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
## [0.3.18] - 2024-05-16
|
|
23
|
+
|
|
15
24
|
### Fixed
|
|
16
25
|
|
|
26
|
+
- `Ecoportal::API::GraphQL::Payload::LocationStructure::CommandExecutionResult`
|
|
27
|
+
- Error is nullable
|
|
28
|
+
|
|
17
29
|
## [0.3.17] - 2024-05-14
|
|
18
30
|
|
|
19
|
-
### Added
|
|
20
|
-
### Changed
|
|
21
31
|
### Fixed
|
|
22
|
-
|
|
32
|
+
|
|
33
|
+
- `field_name` should add up to the path
|
|
23
34
|
|
|
24
35
|
## [0.3.16] - 2024-04-29
|
|
25
36
|
|
|
26
37
|
### Added
|
|
27
|
-
|
|
38
|
+
|
|
39
|
+
- Exposed `graphql` `ContractorEntity` `destroy`
|
|
40
|
+
|
|
28
41
|
### Fixed
|
|
29
|
-
|
|
42
|
+
|
|
43
|
+
- incorrect loading
|
|
30
44
|
|
|
31
45
|
### Changed
|
|
32
|
-
|
|
46
|
+
|
|
47
|
+
- Input for ContractorEntity create moved as `update` (as it wasn't correct)
|
|
33
48
|
|
|
34
49
|
## [0.3.15] - 2024-04-13
|
|
35
50
|
|
|
36
51
|
### Added
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
52
|
+
|
|
53
|
+
- `Ecoportal::API::GraphQL::Logic::BaseQuery`
|
|
54
|
+
- `::base_path` class instance var.
|
|
55
|
+
- query to retrieve `currentOrganization.classifications`
|
|
40
56
|
|
|
41
57
|
### Fixed
|
|
42
|
-
|
|
58
|
+
|
|
59
|
+
- upgraded `ecoportal-api-v2` gem
|
|
43
60
|
|
|
44
61
|
## [0.3.14] - 2024-03-13
|
|
45
62
|
|
|
46
63
|
### Added
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
64
|
+
|
|
65
|
+
- some benchmarking on
|
|
66
|
+
1. core graphql base `query`
|
|
67
|
+
- `#parent_id` to location node model
|
|
50
68
|
|
|
51
69
|
### Changed
|
|
52
|
-
|
|
70
|
+
|
|
71
|
+
- upgraded `ecoportal-v2-api` gem
|
|
53
72
|
|
|
54
73
|
### Fixed
|
|
55
|
-
|
|
74
|
+
|
|
75
|
+
- Optimized `treeify` and locations structure class
|
|
56
76
|
|
|
57
77
|
## [0.3.13] - 2024-02-03
|
|
58
78
|
|
|
59
79
|
### Changed
|
|
60
|
-
|
|
80
|
+
|
|
81
|
+
- upgrade `ecoportal-api-v2`
|
|
61
82
|
|
|
62
83
|
## [0.3.12] - 2024-01-27
|
|
63
84
|
|
|
64
85
|
### Added
|
|
65
|
-
|
|
86
|
+
|
|
87
|
+
- Exposed `graphql` `Action` `update` and get a single `action`
|
|
66
88
|
|
|
67
89
|
## [0.3.11] - 2023-09-19
|
|
68
90
|
|
|
69
91
|
### Added
|
|
70
|
-
|
|
92
|
+
|
|
93
|
+
- Exposed `graphql` `ContractorEntity` `create` and `update`
|
|
71
94
|
|
|
72
95
|
## [0.3.10] - 2023-08-12
|
|
73
96
|
|
|
74
97
|
### Fixed
|
|
75
|
-
|
|
76
|
-
|
|
98
|
+
|
|
99
|
+
- `Ecopotal::API::GraphQL::Query::LocationStructure`
|
|
100
|
+
- `query` in basic_block missed an explicitly declared parameter.
|
|
77
101
|
|
|
78
102
|
## [0.3.9] - 2023-08-03
|
|
79
103
|
|
|
80
104
|
### Added
|
|
81
|
-
|
|
82
|
-
|
|
105
|
+
|
|
106
|
+
- `Ecoportal::API::GraphQL::Logic::BaseQuery`
|
|
107
|
+
- Added support for **default** values.
|
|
83
108
|
|
|
84
109
|
## [0.3.8] - 2023-07-18
|
|
85
110
|
|
|
86
111
|
### Added
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
112
|
+
|
|
113
|
+
- Integration for archiving actions.
|
|
114
|
+
- `LocationNodeInterface` -> support for `classifications`
|
|
115
|
+
- `Treeify` to dump more data per node (classifications)
|
|
90
116
|
|
|
91
117
|
### Fixed
|
|
92
|
-
|
|
118
|
+
|
|
119
|
+
- Silenced waning messages when redefining `Fragment`s
|
|
93
120
|
|
|
94
121
|
## [0.3.7] - 2023-05-23
|
|
95
122
|
|
|
96
123
|
### Fixed
|
|
97
|
-
|
|
124
|
+
|
|
125
|
+
- `Ecoportal::API::Common::GraphQL::Client` adjusted `read_timeout` and `write_timeout` to `90` seconds.
|
|
98
126
|
|
|
99
127
|
## [0.3.6] - 2023-04-17
|
|
100
128
|
|
|
101
129
|
### Changed
|
|
102
|
-
|
|
130
|
+
|
|
131
|
+
- Softened max version of **gem** dependencies
|
|
103
132
|
|
|
104
133
|
### Fixed
|
|
105
|
-
|
|
106
|
-
|
|
134
|
+
|
|
135
|
+
- `Ecoportal::API::GraphQL::Fragment#define` was not removing previous constants
|
|
136
|
+
- Changed check method to be `::const_defined?`
|
|
107
137
|
|
|
108
138
|
## [0.3.5] - 2023-04-03
|
|
109
139
|
|
|
110
140
|
### Fixed
|
|
111
|
-
|
|
112
|
-
|
|
141
|
+
|
|
142
|
+
- `Ecoportal::API::GraphQL::Helpers::LocationsTree#treeify`
|
|
143
|
+
- Make it real id-case-insensitive (parents in lower case were being missed due to this)
|
|
113
144
|
|
|
114
145
|
## [0.3.4] - 2023-04-03
|
|
115
146
|
|
|
116
147
|
### Added
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
148
|
+
|
|
149
|
+
- `Ecoportal::API::Common::GraphQL::AuthService`
|
|
150
|
+
- `#session_token` added **token auto-renew** functionality (when token expires in less than 90 minutes)
|
|
151
|
+
- `#session_token_renewed`
|
|
120
152
|
|
|
121
153
|
### Fixed
|
|
122
|
-
|
|
154
|
+
|
|
155
|
+
- Enabled to specify `host` (other than `live.ecoportal.com`) by the user
|
|
123
156
|
|
|
124
157
|
## [0.3.3] - 2023-04-02
|
|
125
158
|
|
|
126
159
|
### Fixed
|
|
127
|
-
|
|
160
|
+
|
|
161
|
+
- `Ecoportal::API::GraphQL::Base::LocationNode` **added** attribute `archivedToken`
|
|
128
162
|
|
|
129
163
|
## [0.3.2] - 2023-04-02
|
|
130
164
|
|
|
131
165
|
### Changed
|
|
132
|
-
|
|
166
|
+
|
|
167
|
+
- `Ecoportal::API::GraphQL::Helpers::LocationsTree#treeify` added support for `archived_token`
|
|
133
168
|
|
|
134
169
|
## [0.3.1] - 2023-03-09
|
|
135
170
|
|
|
136
|
-
### Added
|
|
137
171
|
### Changed
|
|
138
|
-
- Upgraded core gem dependency `ecoportal-api-v2`
|
|
139
172
|
|
|
173
|
+
- Upgraded core gem dependency `ecoportal-api-v2`
|
|
140
174
|
|
|
141
175
|
## [0.2.3] - 2023-02-27
|
|
142
176
|
|
|
143
177
|
### Fixed
|
|
144
|
-
|
|
178
|
+
|
|
179
|
+
- Typo in tests LocationsStructures... should read `locationStructures`
|
|
145
180
|
|
|
146
181
|
## [0.2.2] - 2023-02-24
|
|
147
182
|
|
|
148
183
|
### Fixed
|
|
149
|
-
|
|
184
|
+
|
|
185
|
+
- Build gem correctly
|
|
150
186
|
|
|
151
187
|
## [0.2.1] - 2023-02-24
|
|
152
188
|
|
|
153
189
|
### Changed
|
|
154
|
-
|
|
190
|
+
|
|
191
|
+
- Migrate from TagTrees to **reporting structures** (breaking change)
|
|
155
192
|
|
|
156
193
|
### Added
|
|
157
|
-
|
|
194
|
+
|
|
195
|
+
- Basics for reporting structure mutations
|
|
158
196
|
|
|
159
197
|
## [0.1.11] - 2022-11-29
|
|
160
198
|
|
|
161
199
|
### Added
|
|
162
|
-
|
|
163
|
-
|
|
200
|
+
|
|
201
|
+
- `Ecoportal::API::GraphQL::Base::Mutation`
|
|
202
|
+
- Added `createContractorEntity`
|
|
164
203
|
|
|
165
204
|
### Changed
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
|
|
205
|
+
|
|
206
|
+
- **upgraded** `graphlient` gem dependency (support for framents)
|
|
207
|
+
- removed patch in this gem
|
|
208
|
+
- Slight internal refactor of `Ecoportal::API::GraphQL::Base::Query`
|
|
209
|
+
- Upgraded `ecoportal-api-v2` **gem** dependency
|
|
170
210
|
|
|
171
211
|
## [0.1.10] - 2022-09-29
|
|
172
212
|
|
|
173
213
|
### Changed
|
|
174
|
-
|
|
214
|
+
|
|
215
|
+
- **upgraded** `ecoportal-api-v2` gem dependency
|
|
175
216
|
|
|
176
217
|
### Fixed
|
|
177
|
-
|
|
218
|
+
|
|
219
|
+
- Remove debugging message
|
|
178
220
|
|
|
179
221
|
## [0.1.9] - 2022-09-26
|
|
180
222
|
|
|
181
223
|
### Added
|
|
182
|
-
|
|
224
|
+
|
|
225
|
+
- `Ecoportal::API::GraphQL::Query::TagTree`
|
|
183
226
|
|
|
184
227
|
### Changed
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
-
|
|
228
|
+
|
|
229
|
+
- **upgraded** `ecoportal-api-v2` gem dependency
|
|
230
|
+
- added `Ecoportal::API::Common::GraphQL::QueryIntegration`
|
|
231
|
+
- restructured `Ecoportal::API::GraphQL::Model::Organization` class
|
|
232
|
+
- **Patch** on `Graphlient::Query` for fragments support (**pull request**: <https://github.com/ashkan18/graphlient/pull/94>)
|
|
189
233
|
|
|
190
234
|
## [0.1.8] - 2022-09-23
|
|
191
235
|
|
|
192
236
|
### Added
|
|
193
|
-
|
|
237
|
+
|
|
238
|
+
- `currentOrganization.tagTrees` query
|
|
194
239
|
|
|
195
240
|
### Changed
|
|
196
|
-
|
|
197
|
-
|
|
241
|
+
|
|
242
|
+
- **upgraded** `ecoportal-api-v2` gem dependency
|
|
243
|
+
- Restructured the `Query` inheritance chain to make things simpler
|
|
198
244
|
|
|
199
245
|
## [0.1.6] - 2022-09-19
|
|
200
246
|
|
|
201
247
|
### Fixed
|
|
202
|
-
|
|
248
|
+
|
|
249
|
+
- Call to **private** method `remove_const` in `Ecoportal::API::GraphQL::Fragment#define`
|
|
203
250
|
|
|
204
251
|
## [0.1.5] - 2022-09-19
|
|
205
252
|
|
|
206
253
|
### Added
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
-
|
|
210
|
-
|
|
211
|
-
|
|
254
|
+
|
|
255
|
+
- Patch `GraphQL::Query#append_node` so we can use Fragments in blocks using `___` as start of the constant, and `__` for namespace separator
|
|
256
|
+
- Issue/feature request: <https://github.com/ashkan18/graphlient/issues/93>
|
|
257
|
+
- `Ecoportal::API::GraphQL::Fragment#define` provided that client scripts can create their own fragments in their own namespace
|
|
258
|
+
- Exposed `Ecoportal::API::GraphQL#fragments`
|
|
259
|
+
- It will always (re)define in the `Fragment` root namespace
|
|
212
260
|
|
|
213
261
|
## [0.1.4] - 2022-09-16
|
|
214
262
|
|
|
215
263
|
### Fixed
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
264
|
+
|
|
265
|
+
- Able to inject connection block to `each`
|
|
266
|
+
- Error handling delegated to parent class (`QueryConnection`)
|
|
267
|
+
- Retrieve `id` on elements of `Array`
|
|
219
268
|
|
|
220
269
|
## [0.1.3] - 2022-09-15
|
|
221
270
|
|
|
222
271
|
### Fixed
|
|
223
|
-
|
|
272
|
+
|
|
273
|
+
- Fixed circular reference to `org_id` in `Ecoportal::API::Common::GraphQL::Client`
|
|
224
274
|
|
|
225
275
|
## [0.1.2] - 2022-09-15
|
|
226
276
|
|
|
227
277
|
### Changed
|
|
228
|
-
|
|
229
|
-
|
|
278
|
+
|
|
279
|
+
- `Ecoportal::API::GraphQL` addded `email` and `pass` parameters on initialization
|
|
280
|
+
- This allows for integration in some client lib
|
|
230
281
|
|
|
231
282
|
## [0.1.0] - 2022-09-15
|
|
232
283
|
|
|
233
284
|
### Added
|
|
234
|
-
|
|
285
|
+
|
|
286
|
+
- First commit with some basic structure
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
3
|
require "ecoportal/api/graphql_version"
|
|
5
4
|
|
|
@@ -9,26 +8,27 @@ Gem::Specification.new do |spec|
|
|
|
9
8
|
spec.authors = ["Oscar Segura"]
|
|
10
9
|
spec.email = ["oscar@ecoportal.co.nz"]
|
|
11
10
|
|
|
12
|
-
spec.summary =
|
|
11
|
+
spec.summary = "A collection of helpers for interacting with the ecoPortal GraphQL API"
|
|
13
12
|
spec.homepage = "https://www.ecoportal.com"
|
|
14
13
|
spec.licenses = %w[MIT]
|
|
15
14
|
|
|
16
|
-
spec.
|
|
15
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
16
|
+
|
|
17
|
+
spec.required_ruby_version = '>= 3.2.2'
|
|
17
18
|
|
|
18
|
-
spec.files
|
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
19
20
|
f.match(%r{^(test|spec|features)/})
|
|
20
21
|
end
|
|
21
22
|
spec.bindir = "exe"
|
|
22
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
24
|
spec.require_paths = ["lib"]
|
|
24
25
|
|
|
25
|
-
spec.add_development_dependency "bundler", ">= 2.4.12", "< 3"
|
|
26
26
|
spec.add_development_dependency "rspec", ">= 3.12.0", "< 4"
|
|
27
27
|
spec.add_development_dependency "rake", ">= 13.0.3", "< 14"
|
|
28
28
|
spec.add_development_dependency "yard", ">= 0.9.34", "< 1"
|
|
29
29
|
spec.add_development_dependency "redcarpet", ">= 3.6.0", "< 4"
|
|
30
30
|
spec.add_development_dependency "pry" , ">= 0.14"
|
|
31
31
|
|
|
32
|
-
spec.add_dependency 'ecoportal-api-v2', '
|
|
32
|
+
spec.add_dependency 'ecoportal-api-v2', '~> 2.0'
|
|
33
33
|
spec.add_dependency 'graphlient', '>= 0.8.0', '< 0.9'
|
|
34
34
|
end
|
|
@@ -3,15 +3,20 @@ module Ecoportal
|
|
|
3
3
|
module Common
|
|
4
4
|
module GraphQL
|
|
5
5
|
module AuthService
|
|
6
|
-
DEFAULT_SERVER = "live.ecoportal.com"
|
|
6
|
+
DEFAULT_SERVER = "live.ecoportal.com".freeze
|
|
7
7
|
TOKEN_AUTORENEW = 90 # minutes
|
|
8
8
|
|
|
9
9
|
module InstanceMethods
|
|
10
10
|
def session_token(host: server, version: nil, auto_renew: true)
|
|
11
|
-
session_token_data(host: host, version: version).
|
|
12
|
-
|
|
11
|
+
session_token_data(host: host, version: version).then do |body|
|
|
12
|
+
next unless body
|
|
13
|
+
|
|
13
14
|
if auto_renew && token_renew?(body["expires_in"])
|
|
14
|
-
session_token_renewed(
|
|
15
|
+
session_token_renewed(
|
|
16
|
+
host: host,
|
|
17
|
+
version: version,
|
|
18
|
+
refresh_token: body["refresh_token"]
|
|
19
|
+
)
|
|
15
20
|
else
|
|
16
21
|
body["access_token"]
|
|
17
22
|
end
|
|
@@ -20,41 +25,43 @@ module Ecoportal
|
|
|
20
25
|
|
|
21
26
|
def session_token_renewed(host: server, version: nil, refresh_token: nil)
|
|
22
27
|
unless refresh_token
|
|
23
|
-
return
|
|
24
|
-
return
|
|
28
|
+
return unless (body = session_token_data(host: host, version: version))
|
|
29
|
+
return unless (refresh_token = body["resfresh_token"])
|
|
25
30
|
end
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
|
|
32
|
+
session_refresh_token_data(
|
|
33
|
+
host: host,
|
|
34
|
+
version: version,
|
|
35
|
+
refresh_token: refresh_token
|
|
36
|
+
).then do |bdy|
|
|
37
|
+
bdy["access_token"] if bdy
|
|
29
38
|
end
|
|
30
39
|
end
|
|
31
40
|
|
|
32
41
|
private
|
|
33
42
|
|
|
34
43
|
def session_token_data(host: server, version: nil)
|
|
35
|
-
http_client(host: host, version: version).post(
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
end
|
|
44
|
+
http_client(host: host, version: version).post(
|
|
45
|
+
"/oauth/token",
|
|
46
|
+
data: {
|
|
47
|
+
"grant_type" => "password",
|
|
48
|
+
"email" => user_email,
|
|
49
|
+
"password" => user_pass
|
|
50
|
+
}
|
|
51
|
+
).then do |response|
|
|
52
|
+
next response.body if response.success?
|
|
45
53
|
end
|
|
46
54
|
end
|
|
47
55
|
|
|
48
|
-
def session_refresh_token_data(host: server, version: nil
|
|
49
|
-
http_client(host: host, version: version).post(
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
end
|
|
56
|
+
def session_refresh_token_data(refresh_token:, host: server, version: nil)
|
|
57
|
+
http_client(host: host, version: version).post(
|
|
58
|
+
"/oauth/token",
|
|
59
|
+
data: {
|
|
60
|
+
"grant_type" => "refresh_token",
|
|
61
|
+
"refresh_token" => refresh_token
|
|
62
|
+
}
|
|
63
|
+
).then do |response|
|
|
64
|
+
next response.body if response.success?
|
|
58
65
|
end
|
|
59
66
|
end
|
|
60
67
|
|
|
@@ -63,7 +70,10 @@ module Ecoportal
|
|
|
63
70
|
end
|
|
64
71
|
|
|
65
72
|
def http_client(host: server, version: nil)
|
|
66
|
-
@http_client ||= Ecoportal::API::Common::GraphQL::HttpClient.new(
|
|
73
|
+
@http_client ||= Ecoportal::API::Common::GraphQL::HttpClient.new(
|
|
74
|
+
host: host,
|
|
75
|
+
version: version
|
|
76
|
+
)
|
|
67
77
|
end
|
|
68
78
|
|
|
69
79
|
def user_email
|
|
@@ -4,15 +4,21 @@ module Ecoportal
|
|
|
4
4
|
module Common
|
|
5
5
|
module GraphQL
|
|
6
6
|
class Client < ::Graphlient::Client
|
|
7
|
-
attr_accessor :
|
|
7
|
+
attr_accessor :host
|
|
8
8
|
|
|
9
9
|
READ_TIMEOUT = 90
|
|
10
10
|
WRITE_TIMEOUT = 90
|
|
11
11
|
|
|
12
12
|
include Ecoportal::API::Common::GraphQL::AuthService
|
|
13
13
|
|
|
14
|
-
def initialize(
|
|
15
|
-
|
|
14
|
+
def initialize(
|
|
15
|
+
email: nil,
|
|
16
|
+
pass: nil,
|
|
17
|
+
org_id: self.org_id,
|
|
18
|
+
host: server,
|
|
19
|
+
schema_path: host,
|
|
20
|
+
no_schema: false
|
|
21
|
+
)
|
|
16
22
|
@org_id = org_id
|
|
17
23
|
@host = host
|
|
18
24
|
@no_schema = no_schema
|
|
@@ -21,7 +27,7 @@ module Ecoportal
|
|
|
21
27
|
|
|
22
28
|
puts "Configuring GraphQL Client onto '#{url}'"
|
|
23
29
|
super(url,
|
|
24
|
-
headers:
|
|
30
|
+
headers: {
|
|
25
31
|
'Authorization' => "Bearer #{session_token(host: host)}"
|
|
26
32
|
},
|
|
27
33
|
http_options: {
|
|
@@ -5,7 +5,7 @@ module Ecoportal
|
|
|
5
5
|
class HttpClient < Common::Client
|
|
6
6
|
class << self
|
|
7
7
|
def base_url(host)
|
|
8
|
-
|
|
8
|
+
"#{protocol(host)}://#{host}"
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def protocol(host)
|
|
@@ -15,8 +15,20 @@ module Ecoportal
|
|
|
15
15
|
|
|
16
16
|
attr_reader :host, :version
|
|
17
17
|
|
|
18
|
-
def initialize(
|
|
19
|
-
|
|
18
|
+
def initialize(
|
|
19
|
+
api_key: nil,
|
|
20
|
+
version: "v1",
|
|
21
|
+
host: "live.ecoportal.com",
|
|
22
|
+
logger: ::Logger.new(IO::NULL),
|
|
23
|
+
response_logging: false
|
|
24
|
+
)
|
|
25
|
+
super(
|
|
26
|
+
api_key: api_key,
|
|
27
|
+
version: version,
|
|
28
|
+
host: host,
|
|
29
|
+
logger: logger,
|
|
30
|
+
response_logging: response_logging
|
|
31
|
+
)
|
|
20
32
|
end
|
|
21
33
|
|
|
22
34
|
def refresh_key(value)
|
|
@@ -27,7 +39,7 @@ module Ecoportal
|
|
|
27
39
|
# @note It configures HTTP so it only allows body data in json format.
|
|
28
40
|
# @return [HTTP] HTTP object.
|
|
29
41
|
def base_request
|
|
30
|
-
@base_request ||=
|
|
42
|
+
@base_request ||=
|
|
31
43
|
case @version
|
|
32
44
|
when NilClass
|
|
33
45
|
HTTP.accept(:json)
|
|
@@ -38,7 +50,6 @@ module Ecoportal
|
|
|
38
50
|
else
|
|
39
51
|
HTTP.headers("X-ApiKey" => key_token).accept(:json)
|
|
40
52
|
end
|
|
41
|
-
end
|
|
42
53
|
end
|
|
43
54
|
|
|
44
55
|
# Full URl builder of the request
|
|
@@ -63,12 +74,12 @@ module Ecoportal
|
|
|
63
74
|
end
|
|
64
75
|
|
|
65
76
|
def base_url_api
|
|
66
|
-
@
|
|
77
|
+
@base_url_api ||= "#{base_url}/api/#{version}"
|
|
67
78
|
end
|
|
68
79
|
|
|
69
80
|
def key_token
|
|
70
81
|
if @api_key.nil? || @api_key.match(/\A\W*\z/)
|
|
71
|
-
if (version == "v0") && key = ENV['ORG_INT_KEY']
|
|
82
|
+
if (version == "v0") && (key = ENV['ORG_INT_KEY'])
|
|
72
83
|
key
|
|
73
84
|
else
|
|
74
85
|
puts "Api-key missing!"
|
|
@@ -5,7 +5,7 @@ module Ecoportal
|
|
|
5
5
|
module LocationStructure
|
|
6
6
|
class CommandExecutionResult < Ecoportal::API::GraphQL::Base::Model
|
|
7
7
|
embeds_one :command, klass: Ecoportal::API::GraphQL::Payload::LocationStructure::CommandInterface
|
|
8
|
-
embeds_one :error, klass: Ecoportal::API::GraphQL::Error::LocationsError
|
|
8
|
+
embeds_one :error, nullable: true, klass: Ecoportal::API::GraphQL::Error::LocationsError
|
|
9
9
|
passboolean :ok
|
|
10
10
|
end
|
|
11
11
|
end
|
metadata
CHANGED
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ecoportal-api-graphql
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oscar Segura
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-08-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: bundler
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.4.12
|
|
20
|
-
- - "<"
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: '3'
|
|
23
|
-
type: :development
|
|
24
|
-
prerelease: false
|
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
-
requirements:
|
|
27
|
-
- - ">="
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: 2.4.12
|
|
30
|
-
- - "<"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '3'
|
|
33
13
|
- !ruby/object:Gem::Dependency
|
|
34
14
|
name: rspec
|
|
35
15
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,22 +108,16 @@ dependencies:
|
|
|
128
108
|
name: ecoportal-api-v2
|
|
129
109
|
requirement: !ruby/object:Gem::Requirement
|
|
130
110
|
requirements:
|
|
131
|
-
- - "
|
|
111
|
+
- - "~>"
|
|
132
112
|
- !ruby/object:Gem::Version
|
|
133
|
-
version:
|
|
134
|
-
- - "<"
|
|
135
|
-
- !ruby/object:Gem::Version
|
|
136
|
-
version: '1.2'
|
|
113
|
+
version: '2.0'
|
|
137
114
|
type: :runtime
|
|
138
115
|
prerelease: false
|
|
139
116
|
version_requirements: !ruby/object:Gem::Requirement
|
|
140
117
|
requirements:
|
|
141
|
-
- - "
|
|
142
|
-
- !ruby/object:Gem::Version
|
|
143
|
-
version: 1.1.8
|
|
144
|
-
- - "<"
|
|
118
|
+
- - "~>"
|
|
145
119
|
- !ruby/object:Gem::Version
|
|
146
|
-
version: '
|
|
120
|
+
version: '2.0'
|
|
147
121
|
- !ruby/object:Gem::Dependency
|
|
148
122
|
name: graphlient
|
|
149
123
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -172,8 +146,10 @@ extensions: []
|
|
|
172
146
|
extra_rdoc_files: []
|
|
173
147
|
files:
|
|
174
148
|
- ".gitignore"
|
|
149
|
+
- ".markdownlint.json"
|
|
175
150
|
- ".rspec"
|
|
176
151
|
- ".rubocop.yml"
|
|
152
|
+
- ".ruby-version"
|
|
177
153
|
- ".yardopts"
|
|
178
154
|
- CHANGELOG.md
|
|
179
155
|
- Gemfile
|
|
@@ -317,7 +293,8 @@ files:
|
|
|
317
293
|
homepage: https://www.ecoportal.com
|
|
318
294
|
licenses:
|
|
319
295
|
- MIT
|
|
320
|
-
metadata:
|
|
296
|
+
metadata:
|
|
297
|
+
rubygems_mfa_required: 'true'
|
|
321
298
|
post_install_message:
|
|
322
299
|
rdoc_options: []
|
|
323
300
|
require_paths:
|
|
@@ -326,14 +303,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
326
303
|
requirements:
|
|
327
304
|
- - ">="
|
|
328
305
|
- !ruby/object:Gem::Version
|
|
329
|
-
version: 2.
|
|
306
|
+
version: 3.2.2
|
|
330
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
308
|
requirements:
|
|
332
309
|
- - ">="
|
|
333
310
|
- !ruby/object:Gem::Version
|
|
334
311
|
version: '0'
|
|
335
312
|
requirements: []
|
|
336
|
-
rubygems_version: 3.
|
|
313
|
+
rubygems_version: 3.5.6
|
|
337
314
|
signing_key:
|
|
338
315
|
specification_version: 4
|
|
339
316
|
summary: A collection of helpers for interacting with the ecoPortal GraphQL API
|