check_mobi 1.0.1

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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +15 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +1 -0
  7. data/Gemfile +4 -0
  8. data/Guardfile +42 -0
  9. data/LICENSE.txt +22 -0
  10. data/README.md +37 -0
  11. data/Rakefile +11 -0
  12. data/check_mobi.gemspec +31 -0
  13. data/lib/check_mobi/client.rb +65 -0
  14. data/lib/check_mobi/configuration.rb +44 -0
  15. data/lib/check_mobi/core_ext/hash.rb +11 -0
  16. data/lib/check_mobi/core_ext/string.rb +15 -0
  17. data/lib/check_mobi/errors/required_field_error.rb +3 -0
  18. data/lib/check_mobi/resource.rb +37 -0
  19. data/lib/check_mobi/resources/check_number.rb +20 -0
  20. data/lib/check_mobi/resources/country_list.rb +19 -0
  21. data/lib/check_mobi/resources/my_account.rb +17 -0
  22. data/lib/check_mobi/resources/phone_validation/request_validation.rb +22 -0
  23. data/lib/check_mobi/resources/phone_validation/validation_status.rb +21 -0
  24. data/lib/check_mobi/resources/phone_validation/verify_pin.rb +23 -0
  25. data/lib/check_mobi/resources/prefixes.rb +17 -0
  26. data/lib/check_mobi/resources/sms/details.rb +23 -0
  27. data/lib/check_mobi/resources/sms/send.rb +23 -0
  28. data/lib/check_mobi/resources/voice/actions/hangup.rb +17 -0
  29. data/lib/check_mobi/resources/voice/actions/play.rb +21 -0
  30. data/lib/check_mobi/resources/voice/actions/send_dtmf.rb +22 -0
  31. data/lib/check_mobi/resources/voice/actions/speak.rb +22 -0
  32. data/lib/check_mobi/resources/voice/actions/wait.rb +22 -0
  33. data/lib/check_mobi/resources/voice/call.rb +26 -0
  34. data/lib/check_mobi/resources/voice/call_details.rb +24 -0
  35. data/lib/check_mobi/resources/voice/events.rb +32 -0
  36. data/lib/check_mobi/resources/voice/hangup_call.rb +24 -0
  37. data/lib/check_mobi/response.rb +22 -0
  38. data/lib/check_mobi/shared/class_with_attributes.rb +102 -0
  39. data/lib/check_mobi/version.rb +3 -0
  40. data/lib/check_mobi.rb +45 -0
  41. data/test/check_mobi/check_mobi_test.rb +7 -0
  42. data/test/check_mobi/client_test.rb +64 -0
  43. data/test/check_mobi/configuration_test.rb +55 -0
  44. data/test/check_mobi/core_ext/hash_test.rb +7 -0
  45. data/test/check_mobi/core_ext/string_test.rb +27 -0
  46. data/test/check_mobi/resources/check_number_test.rb +35 -0
  47. data/test/check_mobi/resources/country_test.rb +14 -0
  48. data/test/check_mobi/resources/my_account_test.rb +15 -0
  49. data/test/check_mobi/resources/phone_validation/request_validation_test.rb +47 -0
  50. data/test/check_mobi/resources/phone_validation/validation_status_test.rb +24 -0
  51. data/test/check_mobi/resources/phone_validation/verify_pin_test.rb +27 -0
  52. data/test/check_mobi/resources/prefix_test.rb +15 -0
  53. data/test/check_mobi/resources/sms/detail_test.rb +24 -0
  54. data/test/check_mobi/resources/sms/send_test.rb +57 -0
  55. data/test/check_mobi/resources/voice/actions/hangup_action_test.rb +42 -0
  56. data/test/check_mobi/resources/voice/actions/play_action_test.rb +25 -0
  57. data/test/check_mobi/resources/voice/actions/send_dtmf_action_test.rb +29 -0
  58. data/test/check_mobi/resources/voice/actions/speak_action_test.rb +76 -0
  59. data/test/check_mobi/resources/voice/actions/wait_action_test.rb +26 -0
  60. data/test/check_mobi/resources/voice/call_details_test.rb +16 -0
  61. data/test/check_mobi/resources/voice/call_test.rb +147 -0
  62. data/test/check_mobi/resources/voice/hangup_call_test.rb +16 -0
  63. data/test/check_mobi/shared/class_with_attributes_test.rb +136 -0
  64. data/test/helper.rb +42 -0
  65. metadata +271 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 17ce81a6d95ab1827f5376bdcd5c3f5af0d2b5b5
4
+ data.tar.gz: 80cf70bdb1b17927b5053af4ae553bf67ef18e7a
5
+ SHA512:
6
+ metadata.gz: 3719ffae92e949724bfb0c8236b6acc9a1b44faa1ef0dcbe1f7201dc5e3d64f2b3b40607ef60e3665220603c9d90046c4b211d04fe5d5237838968f29c5dde3d
7
+ data.tar.gz: e44686ce60dac5cee947bb973b1d43913fe39891611028c1566f257faf5316203cf7c238fa0b089302df36fe407a16133d89fe8cba00f26e8f47684e808a56ca
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .idea/*
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ check_mobi_development
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.4.0
data/.travis.yml ADDED
@@ -0,0 +1 @@
1
+ language: ruby
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in check_mobi.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,42 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ guard :minitest do
19
+ # with Minitest::Unit
20
+ watch(%r{^test/(.*)\/?test_(.*)\.rb$})
21
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
22
+ watch(%r{^test/test_helper\.rb$}) { 'test' }
23
+
24
+ # with Minitest::Spec
25
+ # watch(%r{^spec/(.*)_spec\.rb$})
26
+ # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
27
+ # watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
28
+
29
+ # Rails 4
30
+ # watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
31
+ # watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
32
+ # watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
33
+ # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
34
+ # watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
35
+ # watch(%r{^test/.+_test\.rb$})
36
+ # watch(%r{^test/test_helper\.rb$}) { 'test' }
37
+
38
+ # Rails < 4
39
+ # watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
40
+ # watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
41
+ # watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
42
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Md. Mazharul Islam Mithu
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # CheckMobi
2
+
3
+ [![Build Status](https://travis-ci.org/mithucste30/check_mobi.svg?branch=master)](https://travis-ci.org/mithucste30/check_mobi) [![Coverage Status](https://coveralls.io/repos/github/mithucste30/check_mobi/badge.svg?branch=master)](https://coveralls.io/github/mithucste30/check_mobi?branch=master)
4
+
5
+ This gem is ruby wrapper for [CheckMobi](https://checkmobi.com) API.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'check_mobi'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install check_mobi
22
+
23
+ ## Usage
24
+
25
+ To see how to use the gem, goto the project's [wiki](https://github.com/mithucste30/check_mobi/wiki) page.
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it ( https://github.com/mithucste30/check_mobi/fork )
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create a new Pull Request
34
+
35
+ ## License
36
+
37
+ MIT License. Copyright 2017 [Md. Mazharul Islam](http://mazharul.me)
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rake/testtask'
4
+ Rake::TestTask.new do |test|
5
+ test.libs << 'lib' << 'test'
6
+ test.ruby_opts << "-rubygems"
7
+ test.pattern = 'test/**/*_test.rb'
8
+ test.verbose = true
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'check_mobi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "check_mobi"
8
+ spec.version = CheckMobi::VERSION
9
+ spec.authors = ["Md. Mazharul Islam Mithu"]
10
+ spec.email = ["mazharul.freelancer@gmail.com"]
11
+ spec.summary = "sample gem"
12
+ # spec.description = %q{TODO: Write a longer description. Optional.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "minitest", "~> 5.8.4"
24
+ spec.add_development_dependency "guard"
25
+ spec.add_development_dependency "guard-minitest"
26
+ spec.add_development_dependency "coveralls"
27
+ spec.add_development_dependency 'libnotify'
28
+ spec.add_development_dependency 'minitest-focus'
29
+ spec.add_development_dependency 'webmock'
30
+ spec.add_development_dependency 'vcr'
31
+ end
@@ -0,0 +1,65 @@
1
+ require 'net/http'
2
+ require_relative '../check_mobi'
3
+ require_relative 'response'
4
+ require 'json'
5
+ require 'ostruct'
6
+ require 'forwardable'
7
+
8
+ module CheckMobi
9
+
10
+ class Client
11
+
12
+ extend Forwardable
13
+
14
+ ALLOWED_METHODS = %i[get post delete].freeze
15
+
16
+ attr_reader :endpoint, :request, :headers, :response
17
+ def_delegator :response, :code, :status_code
18
+ def_delegators :body, :code
19
+
20
+ def initialize(options = {})
21
+ @endpoint = URI(Configuration::DEFAULT_ENDPOINT +
22
+ options.fetch(:rel_path, '/'))
23
+
24
+ @request = Net::HTTP.const_get(options.fetch(:http_method, :get)
25
+ .to_s.capitalize).new(@endpoint)
26
+ set_headers
27
+ set_body options.fetch(:form_data, {})
28
+ end
29
+
30
+ def perform
31
+ @request.initialize_http_header(@headers)
32
+
33
+ @response = Net::HTTP.start(@endpoint.hostname, @endpoint.port, use_ssl: true) do |http|
34
+ http.request(@request)
35
+ end
36
+
37
+ handle_response
38
+ end
39
+
40
+ def body
41
+ OpenStruct.new(JSON.parse(response.body))
42
+ end
43
+
44
+ def is_successful
45
+ code === /^"20\d"$/
46
+ end
47
+
48
+ private
49
+
50
+ def set_headers
51
+ @headers = {}
52
+ @headers['Content-Type'] = CheckMobi.content_type
53
+ @headers['Accept'] = CheckMobi.accept_type
54
+ @headers['Authorization'] = CheckMobi.api_key
55
+ end
56
+
57
+ def set_body(form_data)
58
+ @request.body = form_data.to_json if @request.request_body_permitted?
59
+ end
60
+
61
+ def handle_response
62
+ CheckMobi::Response.new self
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,44 @@
1
+ module CheckMobi
2
+ module Configuration
3
+ VALID_CONNECTION_KEYS = [:endpoint, :user_agent, :method, :content_type, :accept_type].freeze
4
+ VALID_OPTIONS_KEYS = [:api_key, :format].freeze
5
+ VALID_CONFIG_KEYS = (VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS).freeze
6
+
7
+ DEFAULT_ENDPOINT = 'https://api.checkmobi.com/v1'.freeze
8
+
9
+ DEFAULT_METHOD = :get.freeze
10
+ DEFAULT_USER_AGENT = "CheckMobi API Ruby Gem".freeze
11
+
12
+ DEFAULT_API_KEY = nil.freeze
13
+ DEFAULT_FORMAT = :json.freeze
14
+ DEFAULT_CONTENT_TYPE = "application/json".freeze
15
+ DEFAULT_ACCEPT_TYPE = "application/json".freeze
16
+ DEFAULT_PLATFORM = 'web'
17
+
18
+ attr_accessor *VALID_CONFIG_KEYS
19
+
20
+ def self.extended(base)
21
+ base.reset
22
+ end
23
+
24
+ def reset
25
+ self.endpoint = DEFAULT_ENDPOINT
26
+ self.method = DEFAULT_METHOD
27
+ self.user_agent = DEFAULT_USER_AGENT
28
+ self.api_key = DEFAULT_API_KEY
29
+ self.format = DEFAULT_FORMAT
30
+ self.content_type = DEFAULT_CONTENT_TYPE
31
+ self.accept_type = DEFAULT_ACCEPT_TYPE
32
+ end
33
+
34
+ def configure
35
+ yield self
36
+ end
37
+
38
+ def options
39
+ Hash[*VALID_CONFIG_KEYS.map{|key| [key, send(key)]}.flatten]
40
+ end
41
+
42
+ end #configuration
43
+ end
44
+
@@ -0,0 +1,11 @@
1
+ class Hash
2
+ def symbolize_keys
3
+ super if defined? Rails
4
+ self.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
5
+ end
6
+
7
+ def stringify_keys
8
+ super if defined? Rails
9
+ self.inject({}){|memo,(k,v)| memo[k.to_s] = v; memo}
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ class String
2
+ def underscore!
3
+ super if defined? Rails
4
+ self.gsub(/::/, '/').
5
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
6
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
7
+ tr("-", "_").
8
+ downcase!
9
+ end
10
+
11
+ def underscore
12
+ super if defined? Rails
13
+ dup.underscore!
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ class RequiredFieldError < StandardError
2
+
3
+ end
@@ -0,0 +1,37 @@
1
+ require_relative 'client'
2
+ require_relative '../../lib/check_mobi/shared/class_with_attributes'
3
+
4
+ module CheckMobi
5
+ class Resource
6
+ include ClassWithAttributes
7
+
8
+ def perform
9
+ before_perform
10
+ client.perform
11
+ end
12
+
13
+ def client
14
+ Client.new(defaults)
15
+ end
16
+
17
+ private
18
+
19
+ ALLOWED_METHODS = Client::ALLOWED_METHODS
20
+
21
+ def after_initialize
22
+ @platform ||= CheckMobi::Configuration::DEFAULT_PLATFORM if instance_variable_defined?(:@platform)
23
+ end
24
+
25
+ def defaults
26
+ {
27
+ rel_path: nil,
28
+ http_method: nil,
29
+ form_data: nil
30
+ }
31
+ end
32
+
33
+ def before_perform # overridden by subclasses
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,20 @@
1
+ require_relative '../resource'
2
+
3
+ module CheckMobi
4
+ module Resources
5
+ class CheckNumber < Resource
6
+ attributes :phone_number
7
+
8
+ private
9
+
10
+ def defaults
11
+ super.merge!({
12
+ rel_path: '/checknumber',
13
+ http_method: ALLOWED_METHODS[1],
14
+ form_data: {number: phone_number}
15
+ })
16
+ end
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,19 @@
1
+ require_relative '../resource'
2
+
3
+
4
+ module CheckMobi
5
+ module Resources
6
+ class CountryList < Resource
7
+
8
+ private
9
+
10
+ def defaults
11
+ super.merge({
12
+ rel_path: '/countries',
13
+ http_method: ALLOWED_METHODS[0]
14
+ })
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,17 @@
1
+ require_relative '../resource'
2
+
3
+ module CheckMobi
4
+ module Resources
5
+ class MyAccount < Resource
6
+
7
+ private
8
+
9
+ def defaults
10
+ super.merge!({
11
+ rel_path: '/my-account',
12
+ http_method: ALLOWED_METHODS[0]
13
+ })
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ require_relative '../../resource'
2
+
3
+ module CheckMobi
4
+ module Resources
5
+ module PhoneValidation
6
+ class RequestValidation < Resource
7
+
8
+ attributes :number, :type, :language, :notification_callback, :platform
9
+
10
+ private
11
+
12
+ def defaults
13
+ super.merge!({
14
+ rel_path: '/validation/request',
15
+ http_method: ALLOWED_METHODS[1],
16
+ form_data: to_hash
17
+ })
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ require_relative '../../resource'
2
+
3
+ module CheckMobi
4
+ module Resources
5
+ module PhoneValidation
6
+ class ValidationStatus < Resource
7
+
8
+ attributes :id
9
+
10
+ private
11
+
12
+ def defaults
13
+ super.merge!({
14
+ rel_path: "/validation/status/#{@id}",
15
+ http_method: ALLOWED_METHODS[0]
16
+ })
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../../resource'
2
+
3
+ module CheckMobi
4
+ module Resources
5
+ module PhoneValidation
6
+ class VerifyPin < Resource
7
+
8
+ attributes :id, :pin
9
+ attribute :use_server_hangup, default: false
10
+
11
+ private
12
+
13
+ def defaults
14
+ super.merge!({
15
+ rel_path: '/validation/verify',
16
+ http_method: ALLOWED_METHODS[1],
17
+ form_data: to_hash
18
+ })
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ require_relative '../resource'
2
+
3
+ module CheckMobi
4
+ module Resources
5
+ class Prefixes < Resource
6
+
7
+ private
8
+
9
+ def defaults
10
+ {
11
+ rel_path: '/prefixes',
12
+ http_method: ALLOWED_METHODS[0]
13
+ }
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../../resource'
2
+
3
+
4
+ module CheckMobi
5
+ module Resources
6
+ module SMS
7
+ class Details < Resource
8
+
9
+ attributes :id
10
+
11
+ private
12
+
13
+ def defaults
14
+ super.merge!({
15
+ rel_path: "/sms/#{@id}",
16
+ http_method: ALLOWED_METHODS[0]
17
+ })
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../../resource'
2
+
3
+
4
+ module CheckMobi
5
+ module Resources
6
+ module SMS
7
+ class Send < Resource
8
+
9
+ attributes :to, :text, :notification_callback, :platform
10
+
11
+ private
12
+
13
+ def defaults
14
+ super.merge!({
15
+ rel_path: '/sms/send',
16
+ http_method: ALLOWED_METHODS[1],
17
+ form_data: to_hash
18
+ })
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ require_relative '../../../resource'
2
+ require_relative '../events'
3
+
4
+ module CheckMobi
5
+ module Resources
6
+ module Voice
7
+ module Actions
8
+
9
+ class Hangup < Events
10
+ attributes :reason
11
+ end
12
+
13
+ end
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,21 @@
1
+ require_relative '../../../resource'
2
+ require_relative '../events'
3
+
4
+ module CheckMobi
5
+ module Resources
6
+ module Voice
7
+ module Actions
8
+ class Play < Events
9
+ attributes :url, :loop
10
+
11
+ private
12
+
13
+ def after_initialize
14
+ @loop ||= 1
15
+ super
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ require_relative '../../../resource'
2
+ require_relative '../events'
3
+
4
+ module CheckMobi
5
+ module Resources
6
+ module Voice
7
+ module Actions
8
+
9
+ class SendDTMF < Events
10
+ attributes :digits, :async
11
+
12
+ private
13
+
14
+ def after_initialize
15
+ @async = true if @async.nil?
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ require_relative '../../../resource'
2
+ require_relative '../events'
3
+
4
+ module CheckMobi
5
+ module Resources
6
+ module Voice
7
+ module Actions
8
+
9
+ class Speak < Events
10
+ attributes :text, :loop, :voice, :language
11
+
12
+ def after_initialize
13
+ @loop ||= 1
14
+ @voice ||= 'WOMAN'
15
+ @language ||= 'en-US'
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ require_relative '../../../resource'
2
+ require_relative '../events'
3
+
4
+ module CheckMobi
5
+ module Resources
6
+ module Voice
7
+ module Actions
8
+
9
+ class Wait < Events
10
+ attributes :length
11
+
12
+ private
13
+
14
+ def after_initialize
15
+ @length ||= 1
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end