ecoportal-api-oozes 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/ecoportal/api/v2.rb +18 -2
- data/lib/ecoportal/api/v2/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: a177d3aabd94973437f3e4e15e16ee48d3a460031b73329d732ad30e9736a2b4
|
4
|
+
data.tar.gz: 5cce90e07b02cfbb416cf710c2d7d345424c754c019d5d3f50bb4315cc0abf9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88a46f8426347ccc3b771694eeb489f0591f8a9023dcc08860f83683ad369eb8e636bab3324389ec888e8e2aca990fdee2185bb3e1ad5d99f738bf40600246c9
|
7
|
+
data.tar.gz: a3e0a5e6079e24fbe3773b88b4fc455e1f8a9d6db142689871dafe70277b1df92f1736a68e43203cb78abe399e4cc5284a7ade46bccfa8a95058310b5d63573a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.7.2] - 2020-10-07
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- automatic key builder
|
8
|
+
- helper: `Ecoportal::API::V2::v2key` method
|
9
|
+
- `user_key:` and `org_key:` as constructor methods for `Ecoportal::API::V2`
|
10
|
+
### Changed
|
11
|
+
### Fixed
|
12
|
+
|
4
13
|
## [0.7.1] - 2020-10-07
|
5
14
|
|
6
15
|
### Added
|
data/lib/ecoportal/api/v2.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'base64'
|
2
|
+
|
1
3
|
module Ecoportal
|
2
4
|
module API
|
3
5
|
# @attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
|
@@ -8,19 +10,33 @@ module Ecoportal
|
|
8
10
|
|
9
11
|
VERSION = "v2"
|
10
12
|
|
13
|
+
class << self
|
14
|
+
def v2key (ukey, gkey)
|
15
|
+
Base64.urlsafe_encode64({
|
16
|
+
organization: gkey,
|
17
|
+
user: ukey
|
18
|
+
}.to_json)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
11
22
|
class_resolver :registers_class, "Ecoportal::API::V2::Registers"
|
12
23
|
class_resolver :pages_class, "Ecoportal::API::V2::Pages"
|
13
24
|
|
14
25
|
attr_reader :client, :logger
|
15
26
|
|
16
27
|
# Creates an `V2` object to scope version specific api requests.
|
28
|
+
# @note
|
29
|
+
# - you should use either `api_key` or `user_key` and `org_key`
|
17
30
|
# @param api_key [String] the key version to stablish the api connection.
|
31
|
+
# @param user_key [String] the user key used for the api connection (requires `org_key`).
|
32
|
+
# @param org_key [String] the org key used for the api connection (requires `user_key`).
|
18
33
|
# @param host [String] api server domain.
|
19
34
|
# @param logger [Logger] an object with `Logger` interface to generate logs.
|
20
|
-
def initialize(api_key, host: "live.ecoportal.com", logger: default_logger)
|
35
|
+
def initialize(api_key = nil, user_key: nil, org_key: nil, host: "live.ecoportal.com", logger: default_logger)
|
36
|
+
v2key = (user_key && org_key && self.class.v2key(user_key, org_key)) || api_key #|| ENV['X_ECOPORTAL_API_KEY']
|
21
37
|
@logger = logger
|
22
38
|
@client = Common::Content::Client.new(
|
23
|
-
api_key:
|
39
|
+
api_key: v2key,
|
24
40
|
host: host,
|
25
41
|
version: self.class::VERSION,
|
26
42
|
logger: @logger
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecoportal-api-oozes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|