check_mobi 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: 33ce2ef75aa8e8970579bb26cd3a9789b0853a61
4
- data.tar.gz: bf6a344c3f10941e96dd51193454618034f165f0
3
+ metadata.gz: 9faa0d186c645b4a4c6efa107ddd839f497412ff
4
+ data.tar.gz: 39556d936de9c4e327c6c6310b5890375cf082df
5
5
  SHA512:
6
- metadata.gz: 778d38eba2d798b32bc8e6e67a3c75da67ecf3b6bc69b78f040f3f49015b7909e1daa8b1a95a76bdb1afec1a6201620222eb3e6b790b574d2f3fdb3179c8f66e
7
- data.tar.gz: 79be96e4f021823e344e433a202e9b2e01157950b9e6c1051979cc26acb729fbec5cbc18bb7070a0ed5ab33536300a6adfcd7efc919dd67c466b2495d1bbfce8
6
+ metadata.gz: 015bc0bebcc56fed502ee97065a1472abcb26d2d0eb3b0d3d3fac2cb7bd50f5a44c71d3e638a7a6acac6e026075e366896c1583de8087edce984804e160673e5
7
+ data.tar.gz: 06ce250a1495304d160a0ad3f8435816556c8a373d45eb4fb67c773b63ae4f41e64a481c746ad9f50c38673cd5c4a6666cf27c04766f82ac064685472105a00d
@@ -1,10 +1,9 @@
1
1
  class Hash
2
- def symbolize_keys
3
- super if defined? Rails
2
+ def cm_symbolize_keys
4
3
  self.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
5
4
  end
6
5
 
7
- def stringify_keys
6
+ def cm_stringify_keys
8
7
  super if defined? Rails
9
8
  self.inject({}){|memo,(k,v)| memo[k.to_s] = v; memo}
10
9
  end
@@ -1,6 +1,5 @@
1
1
  class String
2
- def underscore!
3
- super if defined? Rails
2
+ def cm_underscore!
4
3
  self.gsub(/::/, '/').
5
4
  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
6
5
  gsub(/([a-z\d])([A-Z])/,'\1_\2').
@@ -8,7 +7,7 @@ class String
8
7
  downcase!
9
8
  end
10
9
 
11
- def underscore
12
- dup.underscore!
10
+ def cm_underscore
11
+ dup.cm_underscore!
13
12
  end
14
13
  end
@@ -15,7 +15,7 @@ module CheckMobi
15
15
  private
16
16
 
17
17
  def after_initialize # overridden by subclasses
18
- @action = self.class.name.split('::').last.underscore!
18
+ @action = self.class.name.split('::').last.cm_underscore!
19
19
  end
20
20
  end
21
21
  end
@@ -29,4 +29,4 @@ end
29
29
  # @required_fields = []
30
30
  # args.each {|field| @required_fields << field}
31
31
  # end
32
- # end
32
+ # end
@@ -1,3 +1,3 @@
1
1
  module CheckMobi
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -57,7 +57,7 @@ describe CheckMobi::Client do
57
57
 
58
58
  it "should accept/return form_data" do
59
59
  @client.send(:set_body, form_data)
60
- JSON.parse(@request.body).symbolize_keys.must_equal form_data
60
+ JSON.parse(@request.body).cm_symbolize_keys.must_equal form_data
61
61
  end
62
62
 
63
63
  end
@@ -1,7 +1,7 @@
1
1
  require 'helper'
2
2
 
3
3
  describe Hash do
4
- it 'should symbolize_keys' do
5
- {'a': 1, "b": 2}.symbolize_keys.must_equal({a: 1, b: 2})
4
+ it 'should cm_symbolize_keys' do
5
+ {'a': 1, "b": 2}.cm_symbolize_keys.must_equal({a: 1, b: 2})
6
6
  end
7
- end
7
+ end
@@ -3,25 +3,25 @@ require_relative '../../../lib/check_mobi/core_ext/string'
3
3
 
4
4
  describe String do
5
5
 
6
- it 'should respond to underscore' do
7
- 'TheSampleClass'.must_respond_to(:underscore)
8
- 'TheSampleClass'.must_respond_to(:underscore!)
6
+ it 'should respond to cm_underscore' do
7
+ 'TheSampleClass'.must_respond_to(:cm_underscore)
8
+ 'TheSampleClass'.must_respond_to(:cm_underscore!)
9
9
  end
10
10
 
11
- it 'should underscore a class string name' do
12
- 'TheSampleClass'.underscore.must_equal 'the_sample_class'
13
- 'TheSampleClass'.underscore!.must_equal 'the_sample_class'
11
+ it 'should cm_underscore a class string name' do
12
+ 'TheSampleClass'.cm_underscore.must_equal 'the_sample_class'
13
+ 'TheSampleClass'.cm_underscore!.must_equal 'the_sample_class'
14
14
  end
15
15
 
16
16
  it 'should put / on namespacing' do
17
- 'SuperTop::Parent::TheSampleClass'.underscore.must_equal 'super_top/parent/the_sample_class'
17
+ 'SuperTop::Parent::TheSampleClass'.cm_underscore.must_equal 'super_top/parent/the_sample_class'
18
18
  end
19
19
 
20
20
  it 'should preserve /' do
21
- 'SuperTop/Parent/TheSampleClass'.underscore.must_equal 'super_top/parent/the_sample_class'
21
+ 'SuperTop/Parent/TheSampleClass'.cm_underscore.must_equal 'super_top/parent/the_sample_class'
22
22
  end
23
23
 
24
24
  it 'should replace - with _' do
25
- 'Super-Top/Parent/The-Sample-Class'.underscore.must_equal 'super_top/parent/the_sample_class'
25
+ 'Super-Top/Parent/The-Sample-Class'.cm_underscore.must_equal 'super_top/parent/the_sample_class'
26
26
  end
27
- end
27
+ end
@@ -30,7 +30,7 @@ describe CheckMobi::Resources::Voice::Actions::Speak do
30
30
  it 'should add speak event correctly' do
31
31
  @resource.events << @speak_action
32
32
  @resource.events.length.must_equal 1
33
- @resource.events.first.action.must_equal @speak_action.class.name.split('::').last.underscore!
33
+ @resource.events.first.action.must_equal @speak_action.class.name.split('::').last.cm_underscore!
34
34
  end
35
35
 
36
36
  it 'should build hashes correctly' do
@@ -39,7 +39,7 @@ describe CheckMobi::Resources::Voice::Actions::Speak do
39
39
  hash.keys.must_include(:events)
40
40
  hash[:events].must_be_instance_of Array
41
41
  hash[:events].first.must_be_instance_of Hash
42
- hash[:events].first[:action].must_equal @speak_action.class.name.split('::').last.underscore!
42
+ hash[:events].first[:action].must_equal @speak_action.class.name.split('::').last.cm_underscore!
43
43
  end
44
44
 
45
45
  it 'should request without text' do
@@ -73,4 +73,4 @@ describe CheckMobi::Resources::Voice::Actions::Speak do
73
73
  times: 1)
74
74
  end
75
75
 
76
- end
76
+ end
@@ -30,31 +30,31 @@ describe CheckMobi::Resources::Voice::Call do
30
30
  it 'should add speak event correctly' do
31
31
  @resource.events << @speak_action
32
32
  @resource.events.length.must_equal 1
33
- @resource.events.first.action.must_equal @speak_action.class.name.split('::').last.underscore!
33
+ @resource.events.first.action.must_equal @speak_action.class.name.split('::').last.cm_underscore!
34
34
  end
35
35
 
36
36
  it 'should add play event correctly' do
37
37
  @resource.events << @play_action
38
38
  @resource.events.length.must_equal 1
39
- @resource.events.first.action.must_equal @play_action.class.name.split('::').last.underscore!
39
+ @resource.events.first.action.must_equal @play_action.class.name.split('::').last.cm_underscore!
40
40
  end
41
41
 
42
42
  it 'should add send_dtmf event correctly' do
43
43
  @resource.events << @send_dtmf
44
44
  @resource.events.length.must_equal 1
45
- @resource.events.first.action.must_equal @send_dtmf.class.name.split('::').last.underscore!
45
+ @resource.events.first.action.must_equal @send_dtmf.class.name.split('::').last.cm_underscore!
46
46
  end
47
47
 
48
48
  it 'should add hangup event correctly' do
49
49
  @resource.events << @hangup_action
50
50
  @resource.events.length.must_equal 1
51
- @resource.events.first.action.must_equal @hangup_action.class.name.split('::').last.underscore!
51
+ @resource.events.first.action.must_equal @hangup_action.class.name.split('::').last.cm_underscore!
52
52
  end
53
53
 
54
54
  it 'should add wait event correctly' do
55
55
  @resource.events << @wait_action
56
56
  @resource.events.length.must_equal 1
57
- @resource.events.first.action.must_equal @wait_action.class.name.split('::').last.underscore!
57
+ @resource.events.first.action.must_equal @wait_action.class.name.split('::').last.cm_underscore!
58
58
  end
59
59
 
60
60
  it 'should add multiple events correctly' do
@@ -66,7 +66,7 @@ describe CheckMobi::Resources::Voice::Call do
66
66
  @resource.events.length.must_equal 3
67
67
  @resource.events.concat [@hangup_action, @wait_action]
68
68
  @resource.events.length.must_equal 5
69
- @resource.events.each {|event| event.action.must_equal event.class.name.split('::').last.underscore!}
69
+ @resource.events.each {|event| event.action.must_equal event.class.name.split('::').last.cm_underscore!}
70
70
  end
71
71
 
72
72
  it 'should have attributes' do
@@ -144,4 +144,4 @@ describe CheckMobi::Resources::Voice::Call do
144
144
  })
145
145
  end
146
146
  end
147
- end
147
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: check_mobi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Md. Mazharul Islam Mithu