client_success 0.1.3 → 0.1.8

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: 2ffd0d7c0caa69fc6378701ac6d08dd4ec6461a3173360ca08ed7d043ea16b16
4
- data.tar.gz: 31e4e16519d3e7c0bffabec84b6219a75f1c333dd773c16cf33ac26597b1d2de
3
+ metadata.gz: 70ea9eb6efc8d3614ed25dc7f50c46bbe90d9a4bd12bfe3b077b7ba336a47cf3
4
+ data.tar.gz: 9095331959d4ee85e42c898bbcbe5bc53723fc326a1d530555b08d3e0ca3e8e8
5
5
  SHA512:
6
- metadata.gz: 3a86a6989f697aeaaeb83213ca22d75d84d08932fb847d6661cdc58f3eb93e8a59cab16271596f401c1fcd23444d462de6ab50e904b182f02415a4769a500361
7
- data.tar.gz: 929a6fb02bf33972b22cfce93ad42bcb9402e3ccd1052e1a41f1322c4698c56fac1c251b6744664b594ade3658e17037d7225c29bf077f0138f3c486df53bb1f
6
+ metadata.gz: f43ae9ba9cbdbb2091579bb649fca77e5091c77d6d0ef01c2ff903ef0b8c7e345258e89b7478ef45e113925c21764a2240a6d563588a88b5b11295ced3fef07b
7
+ data.tar.gz: f43833a93268aaff7726510dcbc0b76101759dde52c684e48513f1adb888fb5ba2a2225130218564587ba7ea42a13d405ab3e03a6a624e0f9838d2ebfecbe3a6
@@ -3,8 +3,6 @@ name: Ruby Gem
3
3
  on:
4
4
  push:
5
5
  branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
6
 
9
7
  jobs:
10
8
  build:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- client_success (0.1.3)
4
+ client_success (0.1.8)
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)
data/README.md CHANGED
@@ -46,6 +46,10 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
46
46
 
47
47
  To install this gem onto your local machine, run `bundle exec rake install`.
48
48
 
49
+ ## Publishing
50
+
51
+ This repository is set up to auto publish to https://rubygems.org/gems/client_success on merge into master.
52
+
49
53
 
50
54
  ## Contributing
51
55
 
@@ -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,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.3".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.3
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-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