agilibox 1.7.4 → 1.8.0

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: 1260285e63ab21a02407fcc7c4e13f81f5e168fee704a2af4e917612b0d07b67
4
- data.tar.gz: a72eddeb10a2a22916aba4dc005eee7183dd3a20f8f63346ea1696c1fa413fb9
3
+ metadata.gz: 32ae9547194bc24867f080fd2d519d8c5121f0bd29c5f04a77ef3a0cc73ab193
4
+ data.tar.gz: b3842b9bcaf9a53cabe3ff70e35397f24486848b5b4b63ba718eeac3197149fc
5
5
  SHA512:
6
- metadata.gz: 5992078d40a5c729a4a15a7068b959dc847ecc7c144eebc13a07210deb89e1b4738a6815cad79be2763b7bb076fea5fdec64a77e719005c71d53d21cceaf45b7
7
- data.tar.gz: 898e4d51ff14f1e280ec56b1f8842ccff72174a58925dfa01d39e2507284fe19f73c4a7a9dd8fe5ffc9b0d520c807ea805a330259ddc0a0597b7a175c536fe06
6
+ metadata.gz: 57219afef63509df9ecef5d62e889f163808acb127634d869b644de4a6510a419880ccbd2bc655e8a892a69cebf29048a0afd2b24efecb72d7cb6f54f2ddf30a
7
+ data.tar.gz: 74850c8fd415e42e1cd1580ab02f55b5b8b5e2ed557f7b70bb7b036c3b801dfa1c38befe388e78dd8428cf15707ad58591b52ec4b8e698257e1cd83c1d51b671
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 1.8.0
6
+ - SMS improvements
7
+ - Replace TapMethods by Tapenade gem
8
+ - Add nilify_blanks dependency
9
+
5
10
  ## 1.7.4
6
11
  - Add `tap_update_columns`and `tap_update_column`
7
12
 
@@ -1,6 +1,8 @@
1
1
  module Agilibox::SMS
2
2
  class << self
3
- attr_writer :strategy
3
+ def strategy=(value)
4
+ @strategy = parse_strategy(value)
5
+ end
4
6
 
5
7
  def strategy
6
8
  @strategy ||= default_strategy
@@ -12,6 +14,14 @@ module Agilibox::SMS
12
14
  @default_from ||= Rails.application.class.to_s.chomp("::Application")
13
15
  end
14
16
 
17
+ def parse_strategy(value)
18
+ if value.is_a?(Symbol)
19
+ "Agilibox::SMS::Strategies::#{value.to_s.camelcase}".constantize
20
+ else
21
+ value
22
+ end
23
+ end
24
+
15
25
  private
16
26
 
17
27
  def default_strategy
@@ -21,7 +21,7 @@ class Agilibox::SMS::ApplicationSMS
21
21
  end
22
22
 
23
23
  def sms(data)
24
- Agilibox::SMS.strategy.new(data)
24
+ Agilibox::SMS::Message.new(data)
25
25
  end
26
26
 
27
27
  class << self
@@ -0,0 +1,25 @@
1
+ class Agilibox::SMS::Message
2
+ attr_reader :data
3
+
4
+ def initialize(data)
5
+ @data = data
6
+ end
7
+
8
+ def strategy=(value)
9
+ @strategy = Agilibox::SMS.parse_strategy(value)
10
+ end
11
+
12
+ def strategy(value = :no_argument)
13
+ self.strategy = value unless value == :no_argument
14
+ @strategy || Agilibox::SMS.strategy
15
+ end
16
+
17
+ def deliver_now
18
+ strategy.call(data)
19
+ end
20
+
21
+ # TODO : Delay
22
+ def deliver_later
23
+ deliver_now
24
+ end
25
+ end
@@ -27,8 +27,6 @@ class Agilibox::SMS::Strategies::AmazonSNS < Agilibox::SMS::Strategies::Base
27
27
  )
28
28
  end
29
29
 
30
- private
31
-
32
30
  def call
33
31
  from = data[:from] || Agilibox::SMS.default_from
34
32
 
@@ -5,18 +5,11 @@ class Agilibox::SMS::Strategies::Base
5
5
  @data = data
6
6
  end
7
7
 
8
- def deliver_now
9
- call
10
- end
11
-
12
- # TODO : Delay
13
- def deliver_later
14
- deliver_now
15
- end
16
-
17
- private
18
-
19
8
  def call
20
9
  raise NotImplementedError
21
10
  end
11
+
12
+ def self.call(*args)
13
+ new(*args).call
14
+ end
22
15
  end
@@ -3,8 +3,6 @@ class Agilibox::SMS::Strategies::Test < Agilibox::SMS::Strategies::Base
3
3
  @deliveries ||= []
4
4
  end
5
5
 
6
- private
7
-
8
6
  def call
9
7
  self.class.deliveries << data
10
8
  Rails.logger.info "New SMS sent : #{data.inspect}"
@@ -1,6 +1,8 @@
1
1
  require "awesome_print"
2
2
  require "pry-rails"
3
3
  require "rails-i18n"
4
+ require "nilify_blanks"
5
+ require "tapenade"
4
6
 
5
7
  module Agilibox
6
8
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = "1.7.4"
2
+ VERSION = "1.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agilibox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-01 00:00:00.000000000 Z
11
+ date: 2019-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-i18n
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nilify_blanks
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: tapenade
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description: Agilibox
56
84
  email:
57
85
  - contact@agilidee.com
@@ -133,7 +161,6 @@ files:
133
161
  - app/models/concerns/agilibox/pluck_to_hash.rb
134
162
  - app/models/concerns/agilibox/polymorphic_id.rb
135
163
  - app/models/concerns/agilibox/search.rb
136
- - app/models/concerns/agilibox/tap_methods.rb
137
164
  - app/models/concerns/agilibox/timestamp_helpers.rb
138
165
  - app/serializers/agilibox/serializers.rb
139
166
  - app/serializers/agilibox/serializers/axlsx.rb
@@ -142,6 +169,7 @@ files:
142
169
  - app/services/agilibox/service.rb
143
170
  - app/sms/agilibox/sms.rb
144
171
  - app/sms/agilibox/sms/application_sms.rb
172
+ - app/sms/agilibox/sms/message.rb
145
173
  - app/sms/agilibox/sms/strategies/amazon_sns.rb
146
174
  - app/sms/agilibox/sms/strategies/base.rb
147
175
  - app/sms/agilibox/sms/strategies/test.rb
@@ -1,33 +0,0 @@
1
- module Agilibox::TapMethods
2
- extend ActiveSupport::Concern
3
-
4
- def tap_save!(options = {})
5
- save!(options)
6
- self
7
- end
8
-
9
- def tap_update!(attributes)
10
- update!(attributes)
11
- self
12
- end
13
-
14
- def tap_validate(context = nil)
15
- validate(context)
16
- self
17
- end
18
-
19
- def tap_validate!(context = nil)
20
- validate!(context)
21
- self
22
- end
23
-
24
- def tap_update_columns(attributes)
25
- update_columns(attributes) # rubocop:disable Rails/SkipsModelValidations
26
- self
27
- end
28
-
29
- def tap_update_column(name, value)
30
- update_column(name, value) # rubocop:disable Rails/SkipsModelValidations
31
- self
32
- end
33
- end