ecoportal-api 0.10.12 → 0.10.15
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 +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +19 -3
- data/lib/ecoportal/api/common/client.rb +6 -5
- data/lib/ecoportal/api/v1/person.rb +25 -0
- data/lib/ecoportal/api/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9f1140595821ac9fa4c456761eead0dcfa575c2fe638ed54c0d42cd3b24c7c7
|
|
4
|
+
data.tar.gz: 62c241b84ab6552812a8e6b386aff188fd126201dbe6f5243f58882ccaa9572f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e82ade621496ffefce230aae2b95c5a0a5a54808b5c604ffdc7b3329c5221051f1780e0084c8ab4a7f8179c17b7fd4f5afba5da10510d9fa2b6eb985984ed529
|
|
7
|
+
data.tar.gz: bc52feca422916fc79dcd4b5424c4fa6c04af03dea5496db8c9c1869926646ad0bbaffa3397ff7a560c51de47eee1d21853ca30b9e0692a73c7f1b801cbb18a1
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -2,16 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [0.10.
|
|
5
|
+
## [0.10.16] - 2026-01-xx
|
|
6
6
|
|
|
7
7
|
### Added
|
|
8
8
|
|
|
9
|
-
- `Client#post` **added** named argument `params` (for the **url** arguments)
|
|
10
|
-
|
|
11
9
|
### Changed
|
|
12
10
|
|
|
13
11
|
### Fixed
|
|
14
12
|
|
|
13
|
+
## [0.10.15] - 2026-05-26
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- `Client.new` keep `@version` var when parameter not specified.
|
|
18
|
+
|
|
19
|
+
## [0.10.14] - 2025-08-15
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- `Person#phone_number`
|
|
24
|
+
|
|
25
|
+
## [0.10.12] - 2025-05-30
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- `Client#post` **added** named argument `params` (for the **url** arguments)
|
|
30
|
+
|
|
15
31
|
## [0.10.11] - 2025-05-15
|
|
16
32
|
|
|
17
33
|
### Changed
|
|
@@ -31,7 +31,7 @@ module Ecoportal
|
|
|
31
31
|
MAIN_END_POINT = 'api'.freeze
|
|
32
32
|
|
|
33
33
|
attr_accessor :logger
|
|
34
|
-
attr_reader :host
|
|
34
|
+
attr_reader :host, :version
|
|
35
35
|
|
|
36
36
|
# @note the `api_key` will be automatically added as parameter `X-ApiKey` in the header of the http requests.
|
|
37
37
|
# @param api_key [String] the key version to stablish the api connection.
|
|
@@ -40,8 +40,9 @@ module Ecoportal
|
|
|
40
40
|
# @param logger [Logger] an object with `Logger` interface to generate logs.
|
|
41
41
|
# @param deep_logging [Boolean] whether or not batch responses should be logged
|
|
42
42
|
# @return [Client] an object that holds the configuration of the api connection.
|
|
43
|
-
def initialize(api_key:, version:
|
|
44
|
-
|
|
43
|
+
def initialize(api_key:, version: :unused, host: DEFAULT_HOST, logger: nil, deep_logging: false)
|
|
44
|
+
version = nil if version == :unused
|
|
45
|
+
@version = version unless version.nil?
|
|
45
46
|
@api_key = api_key
|
|
46
47
|
@logger = logger
|
|
47
48
|
@host = host
|
|
@@ -55,12 +56,12 @@ module Ecoportal
|
|
|
55
56
|
|
|
56
57
|
if deep_logging?
|
|
57
58
|
log(:debug) {
|
|
58
|
-
"#{version} client initialized pointing at #{host}"
|
|
59
|
+
"#{self.version} client initialized pointing at #{host}"
|
|
59
60
|
}
|
|
60
61
|
end
|
|
61
62
|
|
|
62
63
|
return unless api_key.nil? || api_key.match(/\A\W*\z/)
|
|
63
|
-
return unless version
|
|
64
|
+
return unless self.version
|
|
64
65
|
|
|
65
66
|
log(:error) { 'Api-key missing!' }
|
|
66
67
|
end
|
|
@@ -13,6 +13,8 @@ module Ecoportal
|
|
|
13
13
|
alias_method :archived?, :archived
|
|
14
14
|
|
|
15
15
|
passthrough :supervisor_id, :contractor_organization_id
|
|
16
|
+
|
|
17
|
+
passthrough :phone_number
|
|
16
18
|
passthrough :brand_id
|
|
17
19
|
passthrough :freemium
|
|
18
20
|
|
|
@@ -22,6 +24,7 @@ module Ecoportal
|
|
|
22
24
|
|
|
23
25
|
VALID_TAG_REGEX = /^[A-Za-z0-9 &_'\/.-]+$/
|
|
24
26
|
VALID_EMAIL_REGEX = /^[^@\s]+@[^@\s]+\.[^@\s]+$/
|
|
27
|
+
NON_PHONE_REGEX = /[^+0-9]/
|
|
25
28
|
|
|
26
29
|
def unarchive!
|
|
27
30
|
self.archived = false
|
|
@@ -65,6 +68,15 @@ module Ecoportal
|
|
|
65
68
|
doc['email'] = value&.downcase
|
|
66
69
|
end
|
|
67
70
|
|
|
71
|
+
# @note this property is read-only in the APIv0.
|
|
72
|
+
# Sets the **primary** phone number of a person.
|
|
73
|
+
# @param value [String, nil] the phone number of this person.
|
|
74
|
+
def phone_number=(value)
|
|
75
|
+
return
|
|
76
|
+
|
|
77
|
+
doc['phone_number'] = parse_number(value)
|
|
78
|
+
end
|
|
79
|
+
|
|
68
80
|
# Validates the string tags of the array, and sets the `filter_tags` property of the account.
|
|
69
81
|
# @note all is set in upper case and preserves the original order.
|
|
70
82
|
# @raise [Exception] if there was any invalid string tag.
|
|
@@ -146,6 +158,19 @@ module Ecoportal
|
|
|
146
158
|
}
|
|
147
159
|
end
|
|
148
160
|
end
|
|
161
|
+
|
|
162
|
+
private
|
|
163
|
+
|
|
164
|
+
def parse_number(value)
|
|
165
|
+
value = value.to_s.strip
|
|
166
|
+
return if value.empty?
|
|
167
|
+
|
|
168
|
+
value.gsub(NON_PHONE_REGEX, '').then do |str|
|
|
169
|
+
next str if str.start_with?('+')
|
|
170
|
+
|
|
171
|
+
"+#{str}"
|
|
172
|
+
end
|
|
173
|
+
end
|
|
149
174
|
end
|
|
150
175
|
end
|
|
151
176
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ecoportal-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tapio Saarinen
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: pry
|
|
@@ -194,7 +193,6 @@ dependencies:
|
|
|
194
193
|
- - "~>"
|
|
195
194
|
- !ruby/object:Gem::Version
|
|
196
195
|
version: '0.1'
|
|
197
|
-
description:
|
|
198
196
|
email:
|
|
199
197
|
- tapio@ecoportal.co.nz
|
|
200
198
|
- oscar@ecoportal.co.nz
|
|
@@ -274,7 +272,6 @@ licenses:
|
|
|
274
272
|
- MIT
|
|
275
273
|
metadata:
|
|
276
274
|
rubygems_mfa_required: 'true'
|
|
277
|
-
post_install_message:
|
|
278
275
|
rdoc_options: []
|
|
279
276
|
require_paths:
|
|
280
277
|
- lib
|
|
@@ -289,8 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
289
286
|
- !ruby/object:Gem::Version
|
|
290
287
|
version: '0'
|
|
291
288
|
requirements: []
|
|
292
|
-
rubygems_version:
|
|
293
|
-
signing_key:
|
|
289
|
+
rubygems_version: 4.0.8
|
|
294
290
|
specification_version: 4
|
|
295
291
|
summary: A collection of helpers for interacting with the ecoPortal MS's various APIs
|
|
296
292
|
test_files: []
|