client_success 0.1.4 → 0.1.9

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: 43bca4c99e8aeaa897f2e755c1f49cee7c931ab9613b65da0c2035722e361439
4
- data.tar.gz: 364dfbfd02747163435e9f28c7d90c23f2f3c9f5cc5b74237dacf6adc17c74fa
3
+ metadata.gz: 1e241d7b5d3764ac0f0f56de081ab3e286c03169669cbb0ce7fc05bd371d7afa
4
+ data.tar.gz: f327cd78f764a18ebf856ee8e6b0e3b7e675730be2e5b324d1cecb5d7d620995
5
5
  SHA512:
6
- metadata.gz: 25e3e80f55f58ef83f98c2893946f519a30e9af8089744ab63f121460f244fed2bd517d37cd074677cb0d5e116aa3e9eca7c2c584007abc1c170707a8eaee976
7
- data.tar.gz: 0d2bae1dea7f922019295a1aa509e2b69b83d25b8abb59af2a0f39ecd5ff2bf9990bf34a5d8d2bcf2de9521ad3bb8480a2a03c6f72009468231445f5afc46308
6
+ metadata.gz: 4f386bcf95f20e0c1bf007d68bcf70f11184c3fd448ad81f36ec3c9141f63472c741ae97c180c8812c0529e3f6c13b439be6a6d05b6d1100bd393b747a3f2d25
7
+ data.tar.gz: f87c26c132a1c339889836c311415416177e97587ff2916b85e93d285784412e34472994cc8f4409fb60ce02626c5cda8f0f7f62afe823bf7e01990243263751
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- client_success (0.1.4)
4
+ client_success (0.1.9)
5
5
  activesupport (~> 5.2)
6
6
  dry-types (= 0.11.0)
7
7
  faraday
@@ -20,7 +20,7 @@ GEM
20
20
  ast (2.4.0)
21
21
  concurrent-ruby (1.1.6)
22
22
  diff-lcs (1.3)
23
- dry-configurable (0.11.3)
23
+ dry-configurable (0.11.5)
24
24
  concurrent-ruby (~> 1.0)
25
25
  dry-core (~> 0.4, >= 0.4.7)
26
26
  dry-equalizer (~> 0.2)
@@ -89,7 +89,7 @@ GEM
89
89
  thread_safe (0.3.6)
90
90
  typhoeus (1.3.1)
91
91
  ethon (>= 0.9.0)
92
- tzinfo (1.2.6)
92
+ tzinfo (1.2.7)
93
93
  thread_safe (~> 0.1)
94
94
  unicode-display_width (1.6.1)
95
95
  vcr (5.1.0)
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["dev@practiceignition.com"]
10
10
 
11
11
  spec.summary = "An unofficial Ruby wrapper for Client Success's REST API"
12
- spec.homepage = "https://github.com/ignitionapp/"
12
+ spec.homepage = "https://github.com/ignitionapp/client_success"
13
13
 
14
14
  # Specify which files should be added to the gem when it is released.
15
15
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -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
@@ -10,6 +10,10 @@ module ClientSuccess
10
10
  class NotFound < Error; end
11
11
 
12
12
  class ParsingError < Error; end
13
+ class Failed < Error; end
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
13
17
 
14
18
  class << self
15
19
  def authorised(access_token)
@@ -60,6 +64,10 @@ module ClientSuccess
60
64
  raise NotImplementedError
61
65
  end
62
66
 
67
+ def strip_emojis(attributes)
68
+ attributes.transform_values { |v| v.respond_to?(:gsub) ? v.gsub(EMOJI_REGEX, "") : v }
69
+ end
70
+
63
71
  private
64
72
 
65
73
  def headers
@@ -92,6 +100,8 @@ module ClientSuccess
92
100
  else
93
101
  raise Error, error
94
102
  end
103
+ rescue Faraday::ConnectionFailed => error
104
+ raise Failed, error
95
105
  rescue SignalException => error
96
106
  raise Error, error
97
107
  end
@@ -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,9 @@ module ClientSuccess
54
56
  end
55
57
 
56
58
  def update(id:, client_id:, attributes:, connection:)
59
+ # for some reason this is breaking client success. Not sure why yet...
60
+ # attributes = connection.strip_emojis(attributes)
61
+
57
62
  body = Schema::Contact::Update[attributes]
58
63
  .transform_keys { |k| k.to_s.camelize(:lower) }
59
64
  .to_json
@@ -1,3 +1,3 @@
1
1
  module ClientSuccess
2
- VERSION = "0.1.4".freeze
2
+ VERSION = "0.1.9".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.4
4
+ version: 0.1.9
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-04-06 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
@@ -244,7 +244,7 @@ files:
244
244
  - lib/client_success/to_do.rb
245
245
  - lib/client_success/types.rb
246
246
  - lib/client_success/version.rb
247
- homepage: https://github.com/ignitionapp/
247
+ homepage: https://github.com/ignitionapp/client_success
248
248
  licenses: []
249
249
  metadata: {}
250
250
  post_install_message:
@@ -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