joy_ussd_engine 0.1.7 → 0.1.10

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: ea7dfcf9e47f093a01d6b8214510d28f671971735521f1f4b2c0a787802bdf63
4
- data.tar.gz: bd7438052940100e6285f822d49badc91e37181eba894a0129430168b0704adf
3
+ metadata.gz: ca534a61cf01d8a83cbd89e6310f88c7bcedfb17f7221880e12a40b654103213
4
+ data.tar.gz: 2d8ddf4b9f35ec40e0b82dbe5e5df7d2c235a0bc17673f6ba322b8e987f9a4d3
5
5
  SHA512:
6
- metadata.gz: 5e4f4f4674c530f0c5815f9d17015722112657705e3c6f584e7965278cd47bcbc2f650e59369d99c7fd08939cec8e316d98e651ce0cc735ca82ecbce1bd075d2
7
- data.tar.gz: 0f35cf308a6236af3fdb86f074a07c8fa4cc78f2cd455dc1a6394596ea85c54e733747fcc00af6a92039b0859844f16e511067b6b588e777a33269fcc3111392
6
+ metadata.gz: c62f11fd5ebec29cb156e7f95f358b3fa50dce911a860e8a38332555e3b6f802303cf134a7b1496306e5614bef8c6413addbac4995e41894693f6a4097c424ef
7
+ data.tar.gz: 02d7a7a53d86bc81041a5ab543703a0fa1ba80f4b582c24429b067cf07cffe77b293faaaf116db0241915c74a8dd8855820f9a898944c0d3deb280d4379544b9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- joy_ussd_engine (0.1.7)
4
+ joy_ussd_engine (0.1.10)
5
5
  will_paginate (~> 3.3.0)
6
6
 
7
7
  GEM
@@ -106,6 +106,7 @@ module JoyUssdEngine
106
106
  data = @context.get_state
107
107
  @previous_client_state = @current_client_state
108
108
  return if data[:"#{@field_name}"].present?
109
+ return @context.set_state({ClientState: state, PrevClientState: @previous_client_state}) if @field_name.blank?
109
110
  # @context.set_state({"#{data[:field]}".to_sym => @context.params[:message]}) unless data[:field].blank?
110
111
  @context.set_state({ClientState: state, PrevClientState: @previous_client_state , field: @field_name, field_error: @field_error, error_text: @error_text})
111
112
  end
@@ -208,12 +209,12 @@ module JoyUssdEngine
208
209
  def run
209
210
  save_field_value
210
211
  do_validation
211
- before_show_menu
212
- before_render
213
212
  return render_menu_error[:data] if @menu_error
214
213
  if allow_validation
215
214
  return render_previous if @previous_menu.field_error
216
215
  end
216
+ before_show_menu
217
+ before_render
217
218
  response = render
218
219
  response = response.blank? ? joy_response(@current_client_state) : response
219
220
  after_render
@@ -225,12 +226,12 @@ module JoyUssdEngine
225
226
  def execute
226
227
  save_field_value
227
228
  do_validation
228
- before_show_menu
229
- before_render
230
229
  return render_menu_error[:data] if @menu_error
231
230
  if allow_validation
232
231
  return render_previous if @previous_menu.field_error
233
232
  end
233
+ before_show_menu
234
+ before_render
234
235
  response = render
235
236
  response = response.blank? ? joy_response(@current_client_state) : response
236
237
  after_render
@@ -6,12 +6,12 @@ module JoyUssdEngine::SessionManager
6
6
  end
7
7
 
8
8
  def user_mobile_number
9
- @user_mobile_number ||= get_state[:"session_id"]
9
+ @user_mobile_number ||= get_state[:"#{@session_id}"]
10
10
  end
11
11
 
12
12
  # Retrive Session Data
13
13
  def get_state
14
- session_id = params["session_id"]
14
+ session_id = params[:"#{@session_id}"]
15
15
  REDIS.with do |conn|
16
16
  data = conn.get(session_id)
17
17
  return {} if data.blank?
@@ -21,7 +21,7 @@ module JoyUssdEngine::SessionManager
21
21
 
22
22
  # Store USSD sessions in Redis with Expiry
23
23
  def set_state(payload = {})
24
- session_id = params["session_id"]
24
+ session_id = params[:"#{@session_id}"]
25
25
  current_data = get_state
26
26
  REDIS.with do |conn|
27
27
  payload = current_data.merge(params.merge(payload))
@@ -32,7 +32,7 @@ module JoyUssdEngine::SessionManager
32
32
 
33
33
  # Delete Session payload
34
34
  def reset_state
35
- session_id = params["session_id"]
35
+ session_id = params[:"#{@session_id}"]
36
36
  REDIS.with do |conn|
37
37
  conn.del(session_id)
38
38
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JoyUssdEngine
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.10"
5
5
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joy_ussd_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Mantey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: will_paginate
@@ -99,13 +99,7 @@ files:
99
99
  - lib/joy_ussd_engine/paginate_menu.rb
100
100
  - lib/joy_ussd_engine/session_manager.rb
101
101
  - lib/joy_ussd_engine/version.rb
102
- - pkg/joy_ussd_engine-0.1.1.gem
103
- - pkg/joy_ussd_engine-0.1.2.gem
104
- - pkg/joy_ussd_engine-0.1.3.gem
105
- - pkg/joy_ussd_engine-0.1.4.gem
106
- - pkg/joy_ussd_engine-0.1.5.gem
107
- - pkg/joy_ussd_engine-0.1.6.gem
108
- - pkg/joy_ussd_engine-0.1.7.gem
102
+ - pkg/joy_ussd_engine-0.1.10.gem
109
103
  - spec/joy_ussd_engine_spec.rb
110
104
  - spec/joy_ussd_engine_transformer.spec
111
105
  - spec/spec_helper.rb
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file