ecoportal-api 0.10.12 → 0.10.14

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: 1c2232426e0251d1242aba6d7a0aa65c545b1bf07f273d23403b0daab0ae57d1
4
- data.tar.gz: e155ec14f82fa569df5eeb4adcb89eb3848b21c902f01009ab4d5644b42b73c4
3
+ metadata.gz: 42c60da1fe6f9c6176e85d65b5283b75b54af11f5e977788eddd7fde57bba953
4
+ data.tar.gz: d5bf03e2eaec6dad5778f8a0ce693b9a29d9786331e5517facab0e28941abccd
5
5
  SHA512:
6
- metadata.gz: 41297931b543449d223f06cb64f46108d96d16141ab8b2a54f10a5bf782d241e8c37060a43807dd4e63d34288f1919c0a716db4a554e5ef4f3da54e42a574561
7
- data.tar.gz: d0d7c16a92811f06df6611ae85fe0e93a62abd950ac478a8be0a6dca7c59fe4e064ca06849d974b913c370c65d79a68593c194324984f7cb3045fe0d5476be62
6
+ metadata.gz: b5d0dfc99e97e97b857a1f424b80e4211811ed7ef6250300a9cd8614a39d5281fef6661519d915a29980a8347368b50bcf7961cfb5a676b6b6d196f16a48cafb
7
+ data.tar.gz: 1ca5a7a3ffc81adc74679524ad715d4833e665867041e7c2c25eace44e98d9612a330dad433e0db4c9e85d95e5fbc5209fc5c46705c1510e91280a011a122c11
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3.2.2
2
+ TargetRubyVersion: 3.2
3
3
  Exclude:
4
4
  - 'config/routes.rb'
5
5
  NewCops: enable
data/CHANGELOG.md CHANGED
@@ -2,16 +2,26 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.10.12] - 2025-05-xx
5
+ ## [0.10.15] - 2025-08-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.14] - 2025-08-15
14
+
15
+ ### Added
16
+
17
+ - `Person#phone_number`
18
+
19
+ ## [0.10.12] - 2025-05-30
20
+
21
+ ### Added
22
+
23
+ - `Client#post` **added** named argument `params` (for the **url** arguments)
24
+
15
25
  ## [0.10.11] - 2025-05-15
16
26
 
17
27
  ### Changed
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- VERSION = '0.10.12'.freeze
3
+ VERSION = '0.10.14'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.12
4
+ version: 0.10.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tapio Saarinen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-29 00:00:00.000000000 Z
11
+ date: 2025-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry