ecoportal-api-graphql 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b2c0cedbda4c84748b943f0abb5b6bca595385f79692189aa7bcf6fb5d1f46b
4
- data.tar.gz: 7e0582c067c29772bc89257fbd83aab19d6268c5500b054cb62a69285c86e992
3
+ metadata.gz: 31998ba790529d40b944c8ee9160a0b916d951f6c2fba7b356316a039fc2464c
4
+ data.tar.gz: bf5db71077c3cdc628b09d558c0a5c224bd93339148fd23deff4f0ac8cb4ef7d
5
5
  SHA512:
6
- metadata.gz: f26eb9930114eac84351856978256e470a8c5a89fef4e54ae7c2424829fbc0970d906865a4a1e3b6e205e72e3e915960c97169bff83af5d6cc286c6cd6703e5d
7
- data.tar.gz: 68de94a4e01bb6d7eb97946adff3456920971453665d9a2069511c76def7771a7bb8998b9cf66ee0ff43493ea4e9ba11a6b3883474f19747893a4a11af6f0379
6
+ metadata.gz: e6d6eef572e2cc6dedf127094e27eca4b2af148b94272f034367ce886d90e228dcbfe9661b101c018c030bf992df1e3624fdcb1fafdda35a7e008ac1b596ea66
7
+ data.tar.gz: bf1ff8931b054e38904ac0e4df51b3bee5c4826e99b5132cf2ae383192c599aa109ff1140e635ee5feb5e79e22e83f899d6878c5261d1d1d4de1e7ba9cc78993
data/CHANGELOG.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.0.2] - 2022-09-xx
4
+ ## [0.0.3] - 2022-09-xx
5
5
 
6
6
  ### Added
7
7
 
8
8
  ### Changed
9
+ - `Ecoportal::API::GraphQL` addded `email` and `pass` parameters on initialization
10
+ - This allows for integration in some client lib
9
11
 
10
12
  ### Fixed
11
13
 
@@ -16,6 +18,12 @@ All notable changes to this project will be documented in this file.
16
18
  - Analyse how to "DSL" currentOrganization.action.activities
17
19
  - review `path` tracking
18
20
 
21
+ ## [0.0.2] - 2022-09-15
22
+
23
+ ### Changed
24
+ - `Ecoportal::API::GraphQL` addded `email` and `pass` parameters on initialization
25
+ - This allows for integration in some client lib
26
+
19
27
  ## [0.0.1] - 2022-09-15
20
28
 
21
29
  ### Added
@@ -13,9 +13,7 @@ module Ecoportal
13
13
  "email" => user_email,
14
14
  "password" => user_pass
15
15
  }).yield_self do |response|
16
- if response.success?
17
- response.body["access_token"]
18
- end
16
+ response.body["access_token"] if response.success?
19
17
  end
20
18
  end
21
19
 
@@ -26,11 +24,11 @@ module Ecoportal
26
24
  end
27
25
 
28
26
  def user_email
29
- fetch_env_required("USER_EMAIL")
27
+ @user_email || fetch_env_required("USER_EMAIL")
30
28
  end
31
29
 
32
30
  def user_pass
33
- fetch_env_required("USER_PASS")
31
+ @user_pass || fetch_env_required("USER_PASS")
34
32
  end
35
33
 
36
34
  def server(default = DEFAULT_SERVER)
@@ -8,10 +8,13 @@ module Ecoportal
8
8
 
9
9
  include Ecoportal::API::Common::GraphQL::AuthService
10
10
 
11
- def initialize(org_id:, host: server, schema_path: host, no_schema: false)
11
+ def initialize(email: nil, pass: nil, org_id: org_id,
12
+ host: server, schema_path: host, no_schema: false)
12
13
  @org_id = org_id
13
14
  @host = host
14
15
  @no_schema = no_schema
16
+ @user_email = email
17
+ @user_pass = pass
15
18
 
16
19
  puts "Configuring GraphQL Client onto '#{url}'"
17
20
  super(url,
@@ -27,12 +30,16 @@ module Ecoportal
27
30
  )
28
31
  end
29
32
 
30
- def new(org_id: self.org_id, host: self.host, schema_path: self.schema_path, no_schema: @no_schema)
33
+ def new(org_id: self.org_id, host: self.host, schema_path: host, no_schema: @no_schema)
31
34
  self.class.new(org_id: org_id, host: host, schema_path: schema_path, no_schema: no_schema)
32
35
  end
33
36
 
34
37
  private
35
38
 
39
+ def org_id
40
+ @org_id || fetch_env_required("ORGANIZATION_ID")
41
+ end
42
+
36
43
  def url
37
44
  "#{Ecoportal::API::Common::GraphQL::HttpClient.base_url(host)}/api/#{org_id}/graphql"
38
45
  end
@@ -11,8 +11,8 @@ module Ecoportal
11
11
  # @param org_id [String] the id of the target organization.
12
12
  # It defaults to the environmental variable `ORGANIZATION_ID`, if defined
13
13
  # @param logger [Logger] an object with `Logger` interface to generate logs.
14
- def initialize(org_id: ENV['ORGANIZATION_ID'])
15
- @client = Ecoportal::API::Common::GraphQL::Client.new(org_id: org_id, no_schema: true)
14
+ def initialize(email: nil, pass: nil, org_id: nil)
15
+ @client = Ecoportal::API::Common::GraphQL::Client.new(email: email, pass: pass, org_id: org_id, no_schema: true)
16
16
  @fragments = Ecoportal::API::GraphQL::Fragment.new(client)
17
17
  end
18
18
 
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GRAPQL_VERSION = "0.1.0"
3
+ GRAPQL_VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura