client_success 0.1.7 → 0.1.8

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: 6111a9c3afb93650bcd20613f2fcde66be74bbf065cfd5a24385d9c2f5fe9bdb
4
- data.tar.gz: 7da8d609bcbfa371b292496c9519eec1ffa52d1536e03dca217fbce784fd6d06
3
+ metadata.gz: 70ea9eb6efc8d3614ed25dc7f50c46bbe90d9a4bd12bfe3b077b7ba336a47cf3
4
+ data.tar.gz: 9095331959d4ee85e42c898bbcbe5bc53723fc326a1d530555b08d3e0ca3e8e8
5
5
  SHA512:
6
- metadata.gz: fecd5cb22b933c9f82346ccca8a2adf6e805da03c63e20c261ea42c6962c2c74f7d599ed6b2233d84b749a3d4ab7e5f9f83ea13258c2b13e345217f6cc5bc834
7
- data.tar.gz: 92bb01a99c9588467251613ef7d351e4287d82380d44a20f6f606066340ae700b901caa966263a287cb5317288099bf04f90502241ff65b9adbefd38850fc7c6
6
+ metadata.gz: f43ae9ba9cbdbb2091579bb649fca77e5091c77d6d0ef01c2ff903ef0b8c7e345258e89b7478ef45e113925c21764a2240a6d563588a88b5b11295ced3fef07b
7
+ data.tar.gz: f43833a93268aaff7726510dcbc0b76101759dde52c684e48513f1adb888fb5ba2a2225130218564587ba7ea42a13d405ab3e03a6a624e0f9838d2ebfecbe3a6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- client_success (0.1.7)
4
+ client_success (0.1.8)
5
5
  activesupport (~> 5.2)
6
6
  dry-types (= 0.11.0)
7
7
  faraday
@@ -55,6 +55,8 @@ module ClientSuccess
55
55
  end
56
56
 
57
57
  def create(attributes:, connection:)
58
+ attributes = connection.strip_emojis(attributes)
59
+
58
60
  body = Schema::Client::Create[attributes]
59
61
  .transform_keys { |k| k.to_s.camelize(:lower) }
60
62
  .to_json
@@ -75,6 +77,8 @@ module ClientSuccess
75
77
  # i.e. any fields not supplied will be set to null - so make sure you
76
78
  # supply everything :)
77
79
  def update(client_id:, attributes:, connection:)
80
+ attributes = connection.strip_emojis(attributes)
81
+
78
82
  body = attributes
79
83
  .deep_transform_keys { |k| k.to_s.camelize(:lower) }
80
84
  .to_json
@@ -12,6 +12,9 @@ module ClientSuccess
12
12
  class ParsingError < Error; end
13
13
  class Failed < Error; end
14
14
 
15
+ # from https://stackoverflow.com/questions/24672834/how-do-i-remove-emoji-from-string
16
+ EMOJI_REGEX = /[\u{203C}\u{2049}\u{20E3}\u{2122}\u{2139}\u{2194}-\u{2199}\u{21A9}-\u{21AA}\u{231A}-\u{231B}\u{23E9}-\u{23EC}\u{23F0}\u{23F3}\u{24C2}\u{25AA}-\u{25AB}\u{25B6}\u{25C0}\u{25FB}-\u{25FE}\u{2600}-\u{2601}\u{260E}\u{2611}\u{2614}-\u{2615}\u{261D}\u{263A}\u{2648}-\u{2653}\u{2660}\u{2663}\u{2665}-\u{2666}\u{2668}\u{267B}\u{267F}\u{2693}\u{26A0}-\u{26A1}\u{26AA}-\u{26AB}\u{26BD}-\u{26BE}\u{26C4}-\u{26C5}\u{26CE}\u{26D4}\u{26EA}\u{26F2}-\u{26F3}\u{26F5}\u{26FA}\u{26FD}\u{2702}\u{2705}\u{2708}-\u{270C}\u{270F}\u{2712}\u{2714}\u{2716}\u{2728}\u{2733}-\u{2734}\u{2744}\u{2747}\u{274C}\u{274E}\u{2753}-\u{2755}\u{2757}\u{2764}\u{2795}-\u{2797}\u{27A1}\u{27B0}\u{2934}-\u{2935}\u{2B05}-\u{2B07}\u{2B1B}-\u{2B1C}\u{2B50}\u{2B55}\u{3030}\u{303D}\u{3297}\u{3299}\u{1F004}\u{1F0CF}\u{1F170}-\u{1F171}\u{1F17E}-\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E7}-\u{1F1EC}\u{1F1EE}-\u{1F1F0}\u{1F1F3}\u{1F1F5}\u{1F1F7}-\u{1F1FA}\u{1F201}-\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}-\u{1F251}\u{1F300}-\u{1F320}\u{1F330}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F380}-\u{1F393}\u{1F3A0}-\u{1F3C4}\u{1F3C6}-\u{1F3CA}\u{1F3E0}-\u{1F3F0}\u{1F400}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4F7}\u{1F4F9}-\u{1F4FC}\u{1F500}-\u{1F507}\u{1F509}-\u{1F53D}\u{1F550}-\u{1F567}\u{1F5FB}-\u{1F640}\u{1F645}-\u{1F64F}\u{1F680}-\u{1F68A}]/.freeze
17
+
15
18
  class << self
16
19
  def authorised(access_token)
17
20
  new.tap { |conn| conn.access_token = access_token }
@@ -61,6 +64,10 @@ module ClientSuccess
61
64
  raise NotImplementedError
62
65
  end
63
66
 
67
+ def strip_emojis(attributes)
68
+ attributes.transform_values { |v| v.respond_to?(:gsub) ? v.gsub(EMOJI_REGEX, "") : v }
69
+ end
70
+
64
71
  private
65
72
 
66
73
  def headers
@@ -40,6 +40,8 @@ module ClientSuccess
40
40
  end
41
41
 
42
42
  def create(client_id:, attributes:, connection:)
43
+ attributes = connection.strip_emojis(attributes)
44
+
43
45
  body = Schema::Contact::Create[attributes]
44
46
  .transform_keys { |k| k.to_s.camelize(:lower) }
45
47
  .to_json
@@ -54,6 +56,8 @@ module ClientSuccess
54
56
  end
55
57
 
56
58
  def update(id:, client_id:, attributes:, connection:)
59
+ attributes = connection.strip_emojis(attributes)
60
+
57
61
  body = Schema::Contact::Update[attributes]
58
62
  .transform_keys { |k| k.to_s.camelize(:lower) }
59
63
  .to_json
@@ -1,3 +1,3 @@
1
1
  module ClientSuccess
2
- VERSION = "0.1.7".freeze
2
+ VERSION = "0.1.8".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client_success
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Practice Ignition
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-29 00:00:00.000000000 Z
11
+ date: 2021-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  - !ruby/object:Gem::Version
263
263
  version: '0'
264
264
  requirements: []
265
- rubygems_version: 3.0.3
265
+ rubygems_version: 3.2.3
266
266
  signing_key:
267
267
  specification_version: 4
268
268
  summary: An unofficial Ruby wrapper for Client Success's REST API