ecoportal-api-graphql 0.1.2 → 0.1.4

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
  SHA256:
3
- metadata.gz: 311f8df4b5b299e4a1aa797958c96307247999738f115c6e475da35f262f4668
4
- data.tar.gz: 64f874379cb32d8df2ca6ae14c51f1cc024b8791dea081f0cf176957c28a1427
3
+ metadata.gz: 5ebcd32d52a269e3f9b9348fdb9e3ca80b3c07a75872e67759d978cd57c233d2
4
+ data.tar.gz: 80bbb9bbaa4a8a420b028cb3f5d4f1685621e176a239710024cede3ab12eed87
5
5
  SHA512:
6
- metadata.gz: 294a8af94c125cf58749562d08c3a1e1c281f6f693586547fe83e2084ae94a56a2291d53c96d1225b6ca11ceec260f9b15e19857cd9ca812a408624303961450
7
- data.tar.gz: 564eafaab9d6585fa7332d863d26ea7f94d319b07f45c0cbeca84ecb8f57cfab25829690a4f6a60aa337ec5d977f5d123d778b0a698a58017f8f33034404ffc8
6
+ metadata.gz: cdbb369046537a6916711f0bbae1cb7a4edd443c6ce19e97bcc529eb6eab72805dd16714aa5a6d165da6690d46d9a0e28e406d036551a6c51b787fd3f44addfb
7
+ data.tar.gz: 0a3f51c9733e66af42edaf63b2c93546cb8ec929fbecfa0dc70a555d9fd846f0228322d2bd85695044e0ac3b875266ae9e3a622f5226d759ebcf1345f287979f
data/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.1.3] - 2022-09-xx
4
+ ## [0.1.5] - 2022-09-xx
5
5
 
6
6
  ### Added
7
7
 
@@ -16,6 +16,18 @@ All notable changes to this project will be documented in this file.
16
16
  - Analyse how to "DSL" currentOrganization.action.activities
17
17
  - review `path` tracking
18
18
 
19
+ ## [0.1.4] - 2022-09-16
20
+
21
+ ### Fixed
22
+ - Able to inject connection block to `each`
23
+ - Error handling delegated to parent class (`QueryConnection`)
24
+ - Retrieve `id` on elements of `Array`
25
+
26
+ ## [0.1.3] - 2022-09-15
27
+
28
+ ### Fixed
29
+ - Fixed circular reference to `org_id` in `Ecoportal::API::Common::GraphQL::Client`
30
+
19
31
  ## [0.1.2] - 2022-09-15
20
32
 
21
33
  ### Changed
@@ -8,7 +8,7 @@ module Ecoportal
8
8
 
9
9
  include Ecoportal::API::Common::GraphQL::AuthService
10
10
 
11
- def initialize(email: nil, pass: nil, org_id: org_id,
11
+ def initialize(email: nil, pass: nil, org_id: self.org_id,
12
12
  host: server, schema_path: host, no_schema: false)
13
13
  @org_id = org_id
14
14
  @host = host
@@ -34,12 +34,12 @@ module Ecoportal
34
34
  self.class.new(org_id: org_id, host: host, schema_path: schema_path, no_schema: no_schema)
35
35
  end
36
36
 
37
- private
38
-
39
37
  def org_id
40
38
  @org_id || fetch_env_required("ORGANIZATION_ID")
41
39
  end
42
40
 
41
+ private
42
+
43
43
  def url
44
44
  "#{Ecoportal::API::Common::GraphQL::HttpClient.base_url(host)}/api/#{org_id}/graphql"
45
45
  end
@@ -20,12 +20,21 @@ module Ecoportal
20
20
  raise "Missuse. You have to implement this method in the child class"
21
21
  end
22
22
 
23
- def each(**kargs, &block)
24
- return to_enum(:each, **kargs) unless block
23
+ def graphql_query(**kargs, &block)
24
+ query_params = self.class.slice_params(kargs)
25
+ client.query(query_params, &block)
26
+ rescue Faraday::ParsingError => e
27
+ puts "Internal Error with these params:"
28
+ pp kargs
29
+ raise
30
+ end
31
+
32
+ def each(connection_block: nil, **kargs, &block)
33
+ return to_enum(:each, **kargs, connection_block: connection_block) unless block
25
34
  cursor = nil; results = 0
26
35
  loop do
27
36
  kargs.update(after: cursor) if cursor
28
- connection = query(**kargs)
37
+ connection = query(**kargs, &connection_block)
29
38
  #total = connection.totalCount
30
39
  pageInfo = connection.pageInfo
31
40
  connection.nodes.each do |item|
@@ -8,10 +8,8 @@ module Ecoportal
8
8
 
9
9
  def query(path: default_base_path, **kargs, &block)
10
10
  path ||= default_base_path
11
- kargs = self.class.slice_params(kargs)
12
11
  request(*path, "actions") do
13
- next client.query(kargs, &basic_block(&block)) if block_given?
14
- client.query(kargs, &basic_block)
12
+ graphql_query(**kargs, &basic_block(&block))
15
13
  end
16
14
  end
17
15
 
@@ -60,9 +58,14 @@ module Ecoportal
60
58
  name
61
59
  description
62
60
  assignedTo {
61
+ id
63
62
  name
64
63
  email
65
64
  }
65
+ createdAt {
66
+ dateTime
67
+ timeZone
68
+ }
66
69
  dueDate {
67
70
  dateTime
68
71
  timeZone
@@ -76,13 +79,11 @@ module Ecoportal
76
79
  email
77
80
  }
78
81
  linkedResources {
82
+ id
79
83
  page {
80
84
  name
81
85
  mouldCounter
82
86
  }
83
- field {
84
- label
85
- }
86
87
  }
87
88
  }
88
89
  }
@@ -8,11 +8,9 @@ module Ecoportal
8
8
 
9
9
  def query(path: default_base_path, **kargs, &block)
10
10
  path ||= default_base_path
11
- kargs = self.class.slice_params(kargs)
12
- ap = access_point(path)
11
+ #ap = access_point(path)
13
12
  request(*path, "contractorEntities") do
14
- next client.query(kargs, &basic_block(&block)) if block_given?
15
- client.query(kargs, &basic_block)
13
+ graphql_query(**kargs, &basic_block(&block))
16
14
  end
17
15
  end
18
16
 
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GRAPQL_VERSION = "0.1.2"
3
+ GRAPQL_VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-15 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler