ecoportal-api-graphql 0.4.1 → 0.4.3

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: 9b010f2e79334e228ef058acb2c53aa92e894907a0a13557188227bb36f5c022
4
- data.tar.gz: fdf9ca5d6486f68be8655a064a5293f1e92cf9d69bb831705ac9916fca60d836
3
+ metadata.gz: 9179222ef94ebb52697888787734813f4aacf5e8267dea6b54c82862087779e0
4
+ data.tar.gz: 495f596b1aef1e11c1fb2bd102bfbdd073325c64f81b608d4d53230ac5037d82
5
5
  SHA512:
6
- metadata.gz: c63be5db720017916fc426ec1cc7d4d1cfd4c510834b10ec5addd401abe48f19e5973395165fee8106ac3e8b400b1ae588e7e1a49a7165bf16028f2441f0e17d
7
- data.tar.gz: 2827e76c1c03965d032a6812ad61f3dcf92940b9baf162ac144fe06102d91cbe53caabf34e477a3862ccd58a419b7ab62bae694d019a7bbe7179b519f576da25
6
+ metadata.gz: 92e8cbd28c4b3d38fcbecf2284c6a6ff268641417009515cd62964eb7a539b2bbdf75fbcd9423e1616c943f49c1ba722c69bb845a0b8870dfa091f25b429a8e3
7
+ data.tar.gz: d5812a7922aa767e912ae4385b3b6117d63e9fbafbf2a4cc404ae274982b2fa0ca95ec6e632544a1d16decde89adb4a8503c253ae0a74a8fb599a7f53d0e6b1d
data/.rubocop.yml CHANGED
@@ -32,6 +32,8 @@ Style/BlockDelimiters:
32
32
  Style/HashSyntax:
33
33
  EnforcedShorthandSyntax: either
34
34
  EnforcedStyle: no_mixed_keys
35
+ Style/ArgumentsForwarding:
36
+ UseAnonymousForwarding: false
35
37
  Style/ClassAndModuleChildren:
36
38
  Enabled: false
37
39
  Style/FrozenStringLiteralComment:
@@ -89,3 +91,5 @@ Naming/RescuedExceptionsVariableName:
89
91
  Enabled: false
90
92
  Naming/MethodName:
91
93
  Enabled: false
94
+ Naming/BlockForwarding:
95
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -9,7 +9,27 @@ All notable changes to this project will be documented in this file.
9
9
  - Analyse how to "DSL" currentOrganization.action.activities
10
10
  - review `path` tracking
11
11
 
12
- ## [0.4.1] - 2024-08-xx
12
+ ## [0.4.3] - 2024-10-xx
13
+
14
+ ### Added
15
+
16
+ ### Changed
17
+
18
+ - upgrade core gem
19
+ - `Ecoportal::API::Common::GraphQL::HttpClient.new` ceased to default `version` to `v1` (now it defaults to `nil`)
20
+
21
+ ### Fixed
22
+
23
+ ## [0.4.2] - 2024-10-01
24
+
25
+ ### Changed
26
+
27
+ - upgrade gems
28
+ - `ecoportal-api`
29
+ - `ecoportal-api-v2`
30
+ - add explicit dependency onto `ecoportal-api` gem (client)
31
+
32
+ ## [0.4.1] - 2024-08-09
13
33
 
14
34
  ### Added
15
35
 
@@ -19,8 +39,6 @@ All notable changes to this project will be documented in this file.
19
39
 
20
40
  - gem upgrade `ecoportal-api-v2`
21
41
 
22
- ### Fixed
23
-
24
42
  ## [0.4.0] - 2024-08-01
25
43
 
26
44
  ### Changed
@@ -27,8 +27,11 @@ Gem::Specification.new do |spec|
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
+ spec.add_development_dependency "rubocop", "~> 1"
31
+ spec.add_development_dependency "rubocop-rake", "~> 0"
30
32
  spec.add_development_dependency "pry" , ">= 0.14"
31
33
 
32
- spec.add_dependency 'ecoportal-api-v2', '~> 2.0', '>= 2.0.8'
34
+ spec.add_dependency 'ecoportal-api', '~> 0.10', '>= 0.10.7'
35
+ spec.add_dependency 'ecoportal-api-v2', '~> 2.0', '>= 2.0.12'
33
36
  spec.add_dependency 'graphlient', '>= 0.8.0', '< 0.9'
34
37
  end
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  module Common
4
4
  module GraphQL
5
5
  module AuthService
6
- DEFAULT_SERVER = "live.ecoportal.com".freeze
6
+ DEFAULT_SERVER = 'live.ecoportal.com'.freeze
7
7
  TOKEN_AUTORENEW = 90 # minutes
8
8
 
9
9
  module InstanceMethods
@@ -11,14 +11,14 @@ module Ecoportal
11
11
  session_token_data(host: host, version: version).then do |body|
12
12
  next unless body
13
13
 
14
- if auto_renew && token_renew?(body["expires_in"])
14
+ if auto_renew && token_renew?(body['expires_in'])
15
15
  session_token_renewed(
16
16
  host: host,
17
17
  version: version,
18
- refresh_token: body["refresh_token"]
18
+ refresh_token: body['refresh_token']
19
19
  )
20
20
  else
21
- body["access_token"]
21
+ body['access_token']
22
22
  end
23
23
  end
24
24
  end
@@ -26,7 +26,7 @@ module Ecoportal
26
26
  def session_token_renewed(host: server, version: nil, refresh_token: nil)
27
27
  unless refresh_token
28
28
  return unless (body = session_token_data(host: host, version: version))
29
- return unless (refresh_token = body["resfresh_token"])
29
+ return unless (refresh_token = body['resfresh_token'])
30
30
  end
31
31
 
32
32
  session_refresh_token_data(
@@ -34,7 +34,7 @@ module Ecoportal
34
34
  version: version,
35
35
  refresh_token: refresh_token
36
36
  ).then do |bdy|
37
- bdy["access_token"] if bdy
37
+ bdy['access_token'] if bdy
38
38
  end
39
39
  end
40
40
 
@@ -42,11 +42,11 @@ module Ecoportal
42
42
 
43
43
  def session_token_data(host: server, version: nil)
44
44
  http_client(host: host, version: version).post(
45
- "/oauth/token",
45
+ '/oauth/token',
46
46
  data: {
47
- "grant_type" => "password",
48
- "email" => user_email,
49
- "password" => user_pass
47
+ 'grant_type' => 'password',
48
+ 'email' => user_email,
49
+ 'password' => user_pass
50
50
  }
51
51
  ).then do |response|
52
52
  next response.body if response.success?
@@ -55,10 +55,10 @@ module Ecoportal
55
55
 
56
56
  def session_refresh_token_data(refresh_token:, host: server, version: nil)
57
57
  http_client(host: host, version: version).post(
58
- "/oauth/token",
58
+ '/oauth/token',
59
59
  data: {
60
- "grant_type" => "refresh_token",
61
- "refresh_token" => refresh_token
60
+ 'grant_type' => 'refresh_token',
61
+ 'refresh_token' => refresh_token
62
62
  }
63
63
  ).then do |response|
64
64
  next response.body if response.success?
@@ -77,11 +77,11 @@ module Ecoportal
77
77
  end
78
78
 
79
79
  def user_email
80
- @user_email || fetch_env_required("USER_EMAIL")
80
+ @user_email || fetch_env_required('USER_EMAIL')
81
81
  end
82
82
 
83
83
  def user_pass
84
- @user_pass || fetch_env_required("USER_PASS")
84
+ @user_pass || fetch_env_required('USER_PASS')
85
85
  end
86
86
 
87
87
  def server(default = DEFAULT_SERVER)
@@ -45,7 +45,7 @@ module Ecoportal
45
45
  end
46
46
 
47
47
  def org_id
48
- @org_id || fetch_env_required("ORGANIZATION_ID")
48
+ @org_id || fetch_env_required('ORGANIZATION_ID')
49
49
  end
50
50
 
51
51
  private
@@ -9,7 +9,7 @@ module Ecoportal
9
9
  end
10
10
 
11
11
  def protocol(host)
12
- host.match(/^localhost|^127\.0\.0\.1/)? "http" : "https"
12
+ host.match(/^localhost|^127\.0\.0\.1/)? 'http' : 'https'
13
13
  end
14
14
  end
15
15
 
@@ -17,17 +17,17 @@ module Ecoportal
17
17
 
18
18
  def initialize(
19
19
  api_key: nil,
20
- version: "v1",
21
- host: "live.ecoportal.com",
20
+ version: nil,
21
+ host: 'live.ecoportal.com',
22
22
  logger: ::Logger.new(IO::NULL),
23
- response_logging: false
23
+ deep_logging: false
24
24
  )
25
25
  super(
26
26
  api_key: api_key,
27
27
  version: version,
28
28
  host: host,
29
29
  logger: logger,
30
- response_logging: response_logging
30
+ deep_logging: deep_logging
31
31
  )
32
32
  end
33
33
 
@@ -43,12 +43,12 @@ module Ecoportal
43
43
  case @version
44
44
  when NilClass
45
45
  HTTP.accept(:json)
46
- when "v2"
47
- HTTP.headers("X-ECOPORTAL-API-KEY" => key_token).accept(:json)
48
- when "graphql"
49
- HTTP.headers("Authorization" => "Bearer #{key_token}").accept(:json)
46
+ when 'v2'
47
+ HTTP.headers('X-ECOPORTAL-API-KEY' => key_token).accept(:json)
48
+ when 'graphql'
49
+ HTTP.headers('Authorization' => "Bearer #{key_token}").accept(:json)
50
50
  else
51
- HTTP.headers("X-ApiKey" => key_token).accept(:json)
51
+ HTTP.headers('X-ApiKey' => key_token).accept(:json)
52
52
  end
53
53
  end
54
54
 
@@ -79,10 +79,10 @@ module Ecoportal
79
79
 
80
80
  def key_token
81
81
  if @api_key.nil? || @api_key.match(/\A\W*\z/)
82
- if (version == "v0") && (key = ENV['ORG_INT_KEY'])
82
+ if (version == 'v0') && (key = ENV['ORG_INT_KEY'])
83
83
  key
84
- else
85
- puts "Api-key missing!"
84
+ elsif !version.nil?
85
+ puts 'Api-key missing!'
86
86
  end
87
87
  else
88
88
  @api_key
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GRAPQL_VERSION = '0.4.1'.freeze
3
+ GRAPQL_VERSION = '0.4.3'.freeze
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.4.1
4
+ version: 0.4.3
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-08-08 00:00:00.000000000 Z
11
+ date: 2024-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -90,6 +90,34 @@ dependencies:
90
90
  - - "<"
91
91
  - !ruby/object:Gem::Version
92
92
  version: '4'
93
+ - !ruby/object:Gem::Dependency
94
+ name: rubocop
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '1'
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '1'
107
+ - !ruby/object:Gem::Dependency
108
+ name: rubocop-rake
109
+ requirement: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ type: :development
115
+ prerelease: false
116
+ version_requirements: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - "~>"
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
93
121
  - !ruby/object:Gem::Dependency
94
122
  name: pry
95
123
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +132,26 @@ dependencies:
104
132
  - - ">="
105
133
  - !ruby/object:Gem::Version
106
134
  version: '0.14'
135
+ - !ruby/object:Gem::Dependency
136
+ name: ecoportal-api
137
+ requirement: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - "~>"
140
+ - !ruby/object:Gem::Version
141
+ version: '0.10'
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 0.10.7
145
+ type: :runtime
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '0.10'
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: 0.10.7
107
155
  - !ruby/object:Gem::Dependency
108
156
  name: ecoportal-api-v2
109
157
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +161,7 @@ dependencies:
113
161
  version: '2.0'
114
162
  - - ">="
115
163
  - !ruby/object:Gem::Version
116
- version: 2.0.8
164
+ version: 2.0.12
117
165
  type: :runtime
118
166
  prerelease: false
119
167
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,7 +171,7 @@ dependencies:
123
171
  version: '2.0'
124
172
  - - ">="
125
173
  - !ruby/object:Gem::Version
126
- version: 2.0.8
174
+ version: 2.0.12
127
175
  - !ruby/object:Gem::Dependency
128
176
  name: graphlient
129
177
  requirement: !ruby/object:Gem::Requirement
@@ -316,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
364
  - !ruby/object:Gem::Version
317
365
  version: '0'
318
366
  requirements: []
319
- rubygems_version: 3.5.6
367
+ rubygems_version: 3.5.23
320
368
  signing_key:
321
369
  specification_version: 4
322
370
  summary: A collection of helpers for interacting with the ecoPortal GraphQL API