ecoportal-api-oozes 0.5.9 → 0.7.2

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: 7ed3bc0b2b7e4fdb51a9ebbf02ca946de0ac8fd7c71359ea8eb1ab545c5f6c9a
4
- data.tar.gz: 7a0151c663ce59132955e5f91cbaed7ef2ff9c62d152c3f89ca233b4851e1c13
3
+ metadata.gz: a177d3aabd94973437f3e4e15e16ee48d3a460031b73329d732ad30e9736a2b4
4
+ data.tar.gz: 5cce90e07b02cfbb416cf710c2d7d345424c754c019d5d3f50bb4315cc0abf9a
5
5
  SHA512:
6
- metadata.gz: cb2172b251d930c72f618576cfcbd17f58ddb4210e93644b01dd6568e2c44914d40c35d09777b86489e86eab0ed82e9c2de71f8396bbb33c9e16f7614ff9fea4
7
- data.tar.gz: 1e3ca2bc12e2d3c077160ca25677ef880c32b8ecd1e66a241443df36950eb5f546d7b2bb1e6bf10caffbaa4e0b75a89f38b8607bb70f539796561af8fa1da5d2
6
+ metadata.gz: 88a46f8426347ccc3b771694eeb489f0591f8a9023dcc08860f83683ad369eb8e636bab3324389ec888e8e2aca990fdee2185bb3e1ad5d99f738bf40600246c9
7
+ data.tar.gz: a3e0a5e6079e24fbe3773b88b4fc455e1f8a9d6db142689871dafe70277b1df92f1736a68e43203cb78abe399e4cc5284a7ade46bccfa8a95058310b5d63573a
@@ -1,7 +1,45 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.5.9] - 2020-06-xx
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
+
13
+ ## [0.7.1] - 2020-10-07
14
+
15
+ ### Added
16
+ ### Changed
17
+ - updated dependencies
18
+ ### Fixed
19
+
20
+
21
+ ## [0.7.0] - 2020-09-10
22
+
23
+ ### Added
24
+ ### Changed
25
+ - updated dependencies
26
+ ### Fixed
27
+
28
+ ## [0.6.1] - 2020-07-11
29
+
30
+ ### Added
31
+ - `Ecoportal::API::Common::Content::DoubleModel#pretty_print`
32
+ ### Changed
33
+ ### Fixed
34
+
35
+ ## [0.6.0] - 2020-07-11
36
+
37
+ ### Added
38
+ ### Changed
39
+ - upgraded `ecoportal-api` gem
40
+ ### Fixed
41
+
42
+ ## [0.5.9] - 2020-07-02
5
43
 
6
44
  ### Added
7
45
  - helper `Ecoportal::API::Common::Content::StringDigest#indexable_label`: to see the part of a label that gets indexed
@@ -20,12 +20,12 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_development_dependency "bundler", "~> 2.1"
24
- spec.add_development_dependency "rake", "~> 12.0"
25
- spec.add_development_dependency "rspec", "~> 3.0"
26
- spec.add_development_dependency "yard", "~> 0.9", ">= 0.9.18"
27
- spec.add_development_dependency "redcarpet", "~> 3.5", ">= 3.5.0"
23
+ spec.add_development_dependency "bundler", ">= 2.1.3", "< 2.2"
24
+ spec.add_development_dependency "rspec", ">= 3.9", "< 4"
25
+ spec.add_development_dependency "rake", ">= 12.3.0", "< 13"
26
+ spec.add_development_dependency "yard", ">= 0.9.18", "< 0.10"
27
+ spec.add_development_dependency "redcarpet", ">= 3.5.0", "< 3.6"
28
28
  spec.add_development_dependency "pry"
29
29
 
30
- spec.add_dependency 'ecoportal-api', '~> 0.5', '>= 0.5.5'
30
+ spec.add_dependency 'ecoportal-api', '>= 0.7.1', '< 0.8'
31
31
  end
@@ -252,10 +252,10 @@ module Ecoportal
252
252
  end
253
253
  end
254
254
 
255
- #def print
256
- # puts JSON.pretty_generate(as_json)
257
- # self
258
- #end
255
+ def pretty_print
256
+ puts JSON.pretty_generate(as_json)
257
+ self
258
+ end
259
259
 
260
260
  def replace_doc(new_doc)
261
261
  raise UnlinkedModel.new(from: "#{self.class}#replace_doc", key: _key) unless linked?
@@ -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: api_key,
39
+ api_key: v2key,
24
40
  host: host,
25
41
  version: self.class::VERSION,
26
42
  logger: @logger
@@ -1,7 +1,7 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class V2
4
- GEM_VERSION = "0.5.9"
4
+ GEM_VERSION = "0.7.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,77 +1,95 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api-oozes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
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-07-02 00:00:00.000000000 Z
11
+ date: 2020-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.3
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '2.1'
22
+ version: '2.2'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '2.1'
29
+ version: 2.1.3
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.2'
27
33
  - !ruby/object:Gem::Dependency
28
- name: rake
34
+ name: rspec
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '3.9'
40
+ - - "<"
32
41
  - !ruby/object:Gem::Version
33
- version: '12.0'
42
+ version: '4'
34
43
  type: :development
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '12.0'
49
+ version: '3.9'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '4'
41
53
  - !ruby/object:Gem::Dependency
42
- name: rspec
54
+ name: rake
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
- - - "~>"
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 12.3.0
60
+ - - "<"
46
61
  - !ruby/object:Gem::Version
47
- version: '3.0'
62
+ version: '13'
48
63
  type: :development
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
52
- - - "~>"
67
+ - - ">="
53
68
  - !ruby/object:Gem::Version
54
- version: '3.0'
69
+ version: 12.3.0
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '13'
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: yard
57
75
  requirement: !ruby/object:Gem::Requirement
58
76
  requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.9'
62
77
  - - ">="
63
78
  - !ruby/object:Gem::Version
64
79
  version: 0.9.18
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.10'
65
83
  type: :development
66
84
  prerelease: false
67
85
  version_requirements: !ruby/object:Gem::Requirement
68
86
  requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '0.9'
72
87
  - - ">="
73
88
  - !ruby/object:Gem::Version
74
89
  version: 0.9.18
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '0.10'
75
93
  - !ruby/object:Gem::Dependency
76
94
  name: redcarpet
77
95
  requirement: !ruby/object:Gem::Requirement
@@ -79,9 +97,9 @@ dependencies:
79
97
  - - ">="
80
98
  - !ruby/object:Gem::Version
81
99
  version: 3.5.0
82
- - - "~>"
100
+ - - "<"
83
101
  - !ruby/object:Gem::Version
84
- version: '3.5'
102
+ version: '3.6'
85
103
  type: :development
86
104
  prerelease: false
87
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -89,9 +107,9 @@ dependencies:
89
107
  - - ">="
90
108
  - !ruby/object:Gem::Version
91
109
  version: 3.5.0
92
- - - "~>"
110
+ - - "<"
93
111
  - !ruby/object:Gem::Version
94
- version: '3.5'
112
+ version: '3.6'
95
113
  - !ruby/object:Gem::Dependency
96
114
  name: pry
97
115
  requirement: !ruby/object:Gem::Requirement
@@ -110,22 +128,22 @@ dependencies:
110
128
  name: ecoportal-api
111
129
  requirement: !ruby/object:Gem::Requirement
112
130
  requirements:
113
- - - "~>"
114
- - !ruby/object:Gem::Version
115
- version: '0.5'
116
131
  - - ">="
117
132
  - !ruby/object:Gem::Version
118
- version: 0.5.5
133
+ version: 0.7.1
134
+ - - "<"
135
+ - !ruby/object:Gem::Version
136
+ version: '0.8'
119
137
  type: :runtime
120
138
  prerelease: false
121
139
  version_requirements: !ruby/object:Gem::Requirement
122
140
  requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: '0.5'
126
141
  - - ">="
127
142
  - !ruby/object:Gem::Version
128
- version: 0.5.5
143
+ version: 0.7.1
144
+ - - "<"
145
+ - !ruby/object:Gem::Version
146
+ version: '0.8'
129
147
  description:
130
148
  email:
131
149
  - rien@ecoportal.co.nz