signalwire 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b8c269b5b78e89a98819b68a62c130263dfdcff42607c6e95dc8e67622ee15c8
4
+ data.tar.gz: de8005aaefa577fbece7ff3b8227c267b9c64d328ab969c57823c36f60b11819
5
+ SHA512:
6
+ metadata.gz: 9152b9da999f73f1b8b320c9aa6aab288347a3341b6d4211de88339b4ebe3b2c5cee79d3734526d033b068c1af14b7a7070fbaad9669b281fd67b83067bd2080
7
+ data.tar.gz: fe827f663f862382c399cc642f681236a4d6f1fe480783118771f97b81ed8c18d5c20b539f2b971e79ccc82392172ce4e5174454ed713d1c9d4ad89cd4551ed9
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,48 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Exclude:
4
+ - 'bin/**/*'
5
+ - 'signalwire-client.gemspec'
6
+ - 'Gemfile'
7
+ - 'vendor/**/*'
8
+
9
+ Metrics/ClassLength:
10
+ Max: 512
11
+
12
+ Metrics/LineLength:
13
+ Max: 120
14
+
15
+ Metrics/ModuleLength:
16
+ Max: 132
17
+
18
+ StringLiterals:
19
+ EnforcedStyle: single_quotes
20
+
21
+ Layout/AccessModifierIndentation:
22
+ EnforcedStyle: outdent
23
+
24
+ Style/Documentation:
25
+ Enabled: false
26
+
27
+ Layout/AlignParameters:
28
+ EnforcedStyle: with_fixed_indentation
29
+
30
+ Style/ConditionalAssignment:
31
+ Enabled: false
32
+
33
+ Style/NumericLiterals:
34
+ Enabled: false
35
+
36
+ Style/ClassAndModuleChildren:
37
+ Enabled: false
38
+
39
+ Style/AndOr:
40
+ Enabled: false
41
+
42
+ Metrics/BlockLength:
43
+ Exclude:
44
+ - 'Rakefile'
45
+ - '**/*.rake'
46
+ - 'spec/**/*.rb'
47
+ - 'Guardfile'
48
+
data/AUTHORS.md ADDED
@@ -0,0 +1,7 @@
1
+ Authors
2
+ =======
3
+
4
+ A huge thanks to all of our contributors:
5
+
6
+
7
+ - Luca Pradovera
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "https://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "twilio-ruby", "~> 5.0"
7
+
8
+ # Add dependencies to develop your gem here.
9
+ # Include everything needed to run rake, tests, features, etc.
10
+ group :development do
11
+ gem "rspec", "~> 3.5.0"
12
+ gem "rdoc", "~> 3.12"
13
+ gem "bundler", "~> 1.0"
14
+ gem "juwelier", "~> 2.1.0"
15
+ gem "simplecov", ">= 0"
16
+ gem 'rubocop', require: false
17
+ gem 'bundler-audit', require: false
18
+ gem 'guard-rspec'
19
+ gem 'webmock'
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,156 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.5.2)
5
+ public_suffix (>= 2.0.2, < 4.0)
6
+ ast (2.4.0)
7
+ builder (3.2.3)
8
+ bundler-audit (0.6.0)
9
+ bundler (~> 1.2)
10
+ thor (~> 0.18)
11
+ coderay (1.1.2)
12
+ crack (0.4.3)
13
+ safe_yaml (~> 1.0.0)
14
+ descendants_tracker (0.0.4)
15
+ thread_safe (~> 0.3, >= 0.3.1)
16
+ diff-lcs (1.3)
17
+ docile (1.3.1)
18
+ faraday (0.12.2)
19
+ multipart-post (>= 1.2, < 3)
20
+ ffi (1.9.25)
21
+ formatador (0.2.5)
22
+ git (1.4.0)
23
+ github_api (0.18.2)
24
+ addressable (~> 2.4)
25
+ descendants_tracker (~> 0.0.4)
26
+ faraday (~> 0.8)
27
+ hashie (~> 3.5, >= 3.5.2)
28
+ oauth2 (~> 1.0)
29
+ guard (2.14.2)
30
+ formatador (>= 0.2.4)
31
+ listen (>= 2.7, < 4.0)
32
+ lumberjack (>= 1.0.12, < 2.0)
33
+ nenv (~> 0.1)
34
+ notiffany (~> 0.0)
35
+ pry (>= 0.9.12)
36
+ shellany (~> 0.0)
37
+ thor (>= 0.18.1)
38
+ guard-compat (1.2.1)
39
+ guard-rspec (4.7.3)
40
+ guard (~> 2.1)
41
+ guard-compat (~> 1.1)
42
+ rspec (>= 2.99.0, < 4.0)
43
+ hashdiff (0.3.7)
44
+ hashie (3.5.7)
45
+ highline (2.0.0)
46
+ jaro_winkler (1.5.1)
47
+ json (1.8.6)
48
+ juwelier (2.1.3)
49
+ builder
50
+ bundler (>= 1.13)
51
+ git (>= 1.2.5)
52
+ github_api
53
+ highline (>= 1.6.15)
54
+ nokogiri (>= 1.5.10)
55
+ rake
56
+ rdoc
57
+ semver
58
+ jwt (1.5.6)
59
+ listen (3.1.5)
60
+ rb-fsevent (~> 0.9, >= 0.9.4)
61
+ rb-inotify (~> 0.9, >= 0.9.7)
62
+ ruby_dep (~> 1.2)
63
+ lumberjack (1.0.13)
64
+ method_source (0.9.0)
65
+ mini_portile2 (2.3.0)
66
+ multi_json (1.13.1)
67
+ multi_xml (0.6.0)
68
+ multipart-post (2.0.0)
69
+ nenv (0.3.0)
70
+ nokogiri (1.8.4)
71
+ mini_portile2 (~> 2.3.0)
72
+ notiffany (0.1.1)
73
+ nenv (~> 0.1)
74
+ shellany (~> 0.0)
75
+ oauth2 (1.4.0)
76
+ faraday (>= 0.8, < 0.13)
77
+ jwt (~> 1.0)
78
+ multi_json (~> 1.3)
79
+ multi_xml (~> 0.5)
80
+ rack (>= 1.2, < 3)
81
+ parallel (1.12.1)
82
+ parser (2.5.1.2)
83
+ ast (~> 2.4.0)
84
+ powerpack (0.1.2)
85
+ pry (0.11.3)
86
+ coderay (~> 1.1.0)
87
+ method_source (~> 0.9.0)
88
+ public_suffix (3.0.2)
89
+ rack (2.0.5)
90
+ rainbow (3.0.0)
91
+ rake (12.3.1)
92
+ rb-fsevent (0.10.3)
93
+ rb-inotify (0.9.10)
94
+ ffi (>= 0.5.0, < 2)
95
+ rdoc (3.12.2)
96
+ json (~> 1.4)
97
+ rspec (3.5.0)
98
+ rspec-core (~> 3.5.0)
99
+ rspec-expectations (~> 3.5.0)
100
+ rspec-mocks (~> 3.5.0)
101
+ rspec-core (3.5.4)
102
+ rspec-support (~> 3.5.0)
103
+ rspec-expectations (3.5.0)
104
+ diff-lcs (>= 1.2.0, < 2.0)
105
+ rspec-support (~> 3.5.0)
106
+ rspec-mocks (3.5.0)
107
+ diff-lcs (>= 1.2.0, < 2.0)
108
+ rspec-support (~> 3.5.0)
109
+ rspec-support (3.5.0)
110
+ rubocop (0.58.1)
111
+ jaro_winkler (~> 1.5.1)
112
+ parallel (~> 1.10)
113
+ parser (>= 2.5, != 2.5.1.1)
114
+ powerpack (~> 0.1)
115
+ rainbow (>= 2.2.2, < 4.0)
116
+ ruby-progressbar (~> 1.7)
117
+ unicode-display_width (~> 1.0, >= 1.0.1)
118
+ ruby-progressbar (1.9.0)
119
+ ruby_dep (1.5.0)
120
+ safe_yaml (1.0.4)
121
+ semver (1.0.1)
122
+ shellany (0.0.1)
123
+ simplecov (0.16.1)
124
+ docile (~> 1.1)
125
+ json (>= 1.8, < 3)
126
+ simplecov-html (~> 0.10.0)
127
+ simplecov-html (0.10.2)
128
+ thor (0.20.0)
129
+ thread_safe (0.3.6)
130
+ twilio-ruby (5.12.3)
131
+ faraday (~> 0.9)
132
+ jwt (>= 1.5, <= 2.5)
133
+ nokogiri (>= 1.6, < 2.0)
134
+ unicode-display_width (1.4.0)
135
+ webmock (3.4.2)
136
+ addressable (>= 2.3.6)
137
+ crack (>= 0.3.2)
138
+ hashdiff
139
+
140
+ PLATFORMS
141
+ ruby
142
+
143
+ DEPENDENCIES
144
+ bundler (~> 1.0)
145
+ bundler-audit
146
+ guard-rspec
147
+ juwelier (~> 2.1.0)
148
+ rdoc (~> 3.12)
149
+ rspec (~> 3.5.0)
150
+ rubocop
151
+ simplecov
152
+ twilio-ruby (~> 5.0)
153
+ webmock
154
+
155
+ BUNDLED WITH
156
+ 1.16.1
data/Guardfile ADDED
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A sample Guardfile
4
+ # More info at https://github.com/guard/guard#readme
5
+
6
+ ## Uncomment and set this to only include directories you want to watch
7
+ # directories %w(app lib config test spec features) \
8
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
9
+
10
+ ## Note: if you are using the `directories` clause above and you are not
11
+ ## watching the project directory ('.'), then you will want to move
12
+ ## the Guardfile to a watched dir and symlink it back, e.g.
13
+ #
14
+ # $ mkdir config
15
+ # $ mv Guardfile config/
16
+ # $ ln -s config/Guardfile .
17
+ #
18
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
19
+
20
+ # Note: The cmd option is now required due to the increasing number of ways
21
+ # rspec may be run, below are examples of the most common uses.
22
+ # * bundler: 'bundle exec rspec'
23
+ # * bundler binstubs: 'bin/rspec'
24
+ # * spring: 'bin/rspec' (This will use spring if running and you have
25
+ # installed the spring binstubs per the docs)
26
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
27
+ # * 'just' rspec: 'rspec'
28
+
29
+ guard :rspec, cmd: 'bundle exec rspec' do
30
+ require 'guard/rspec/dsl'
31
+ dsl = Guard::RSpec::Dsl.new(self)
32
+
33
+ # Feel free to open issues for suggestions and improvements
34
+
35
+ # RSpec files
36
+ rspec = dsl.rspec
37
+ watch(rspec.spec_helper) { rspec.spec_dir }
38
+ watch(rspec.spec_support) { rspec.spec_dir }
39
+ watch(rspec.spec_files)
40
+
41
+ # Ruby files
42
+ ruby = dsl.ruby
43
+ dsl.watch_spec_files_for(ruby.lib_files)
44
+
45
+ # Rails files
46
+ rails = dsl.rails(view_extensions: %w[erb haml slim])
47
+ dsl.watch_spec_files_for(rails.app_files)
48
+ dsl.watch_spec_files_for(rails.views)
49
+
50
+ watch(rails.controllers) do |m|
51
+ [
52
+ rspec.spec.call("routing/#{m[1]}_routing"),
53
+ rspec.spec.call("controllers/#{m[1]}_controller"),
54
+ rspec.spec.call("acceptance/#{m[1]}")
55
+ ]
56
+ end
57
+
58
+ # Rails config changes
59
+ watch(rails.spec_helper) { rspec.spec_dir }
60
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
61
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
62
+
63
+ # Capybara features specs
64
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
65
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
66
+
67
+ # Turnip features and steps
68
+ watch(%r{^spec/acceptance/(.+)\.feature$})
69
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
70
+ Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
71
+ end
72
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2018 Luca Pradovera
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,4 @@
1
+ authors:
2
+ echo "Authors\n=======\n\nA huge thanks to all of our contributors:\n\n" > AUTHORS.md
3
+ git log --raw | grep "^Author: " | cut -d ' ' -f2- | cut -d '<' -f1 | sed 's/^/- /' | sort | uniq >> AUTHORS.md
4
+
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # signalwire-client-ruby
2
+
3
+ This gem provides a client for the Signalwire LAML and REST services.
4
+
5
+ It allows you to create calls, send messages, and generate LAML responses.
6
+
7
+ ## Installation
8
+
9
+ Add `gem 'signalwire'` to your `Gemfile`, or simply `gem install signalwire`.
10
+
11
+ ## SDK Usage
12
+
13
+ Configure your signalwire subdomain, either by setting the environment variable `SIGNALWIRE_API_HOSTNAME=your_subdomain.signalwire.com` or within an
14
+ initializer:
15
+
16
+ ```ruby
17
+ require 'signalwire/sdk'
18
+
19
+ Signalwire::Sdk.configure do |config|
20
+ config.hostname = "your_subdomain.signalwire.com"
21
+ end
22
+ ```
23
+
24
+ Then, setup a client to make requests, your `PROJECT_KEY` and `TOKEN` can be found within your Signalwire account, under Settings -> API Credentials
25
+
26
+ ```ruby
27
+ @client = Signalwire::REST::Client.new PROJECT_KEY, TOKEN
28
+
29
+ @message = @client.messages.create(
30
+ from: '+15551234567',
31
+ to: '+15557654321',
32
+ body: 'This is a message from the Signalwire-Ruby library!'
33
+ )
34
+ ```
35
+
36
+ ### Generating a LAML response
37
+
38
+ ```
39
+ require 'signalwire/sdk'
40
+
41
+ response = Signalwire::Sdk::VoiceResponse.new do |r|
42
+ r.say(message: 'hello there', voice: 'alice')
43
+ r.dial(caller_id: '+14159992222') do |d|
44
+ d.client 'jenny'
45
+ end
46
+ end
47
+
48
+ # print the result
49
+ puts response.to_s
50
+ ```
51
+
52
+ ```
53
+ <?xml version="1.0" encoding="UTF-8"?>
54
+ <Response>
55
+ <Say voice="alice">hello there</Say>
56
+ <Dial callerId="+14159992222">
57
+ <Client>jenny</Client>
58
+ </Dial>
59
+ </Response>
60
+ ```
61
+
62
+ == Contributing to signalwire-client-ruby
63
+
64
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
65
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
66
+ * Fork the project.
67
+ * Start a feature/bugfix branch.
68
+ * Commit and push until you are happy with your contribution.
69
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
70
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
71
+
72
+ == Copyright
73
+
74
+ Copyright (c) 2018 SignalWire Inc. See LICENSE.txt for
75
+ further details.
data/Rakefile ADDED
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ warn e.message
9
+ warn 'Run `bundle install` to install missing gems'
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+ require 'juwelier'
14
+ Juwelier::Tasks.new do |gem|
15
+ gem.name = 'signalwire'
16
+ gem.homepage = 'http://github.com/signalwire/signalwire-ruby'
17
+ gem.license = 'MIT'
18
+ gem.summary = %(Ruby client for Signalwire)
19
+ gem.email = 'open.source@signalwire.com'
20
+ gem.authors = ['SignalWire Team']
21
+
22
+ # dependencies defined in Gemfile
23
+ end
24
+ Juwelier::RubygemsDotOrgTasks.new
25
+ require 'rspec/core'
26
+ require 'rspec/core/rake_task'
27
+ RSpec::Core::RakeTask.new(:spec) do |spec|
28
+ spec.pattern = FileList['spec/**/*_spec.rb']
29
+ end
30
+
31
+ desc 'Code coverage detail'
32
+ task :simplecov do
33
+ ENV['COVERAGE'] = 'true'
34
+ Rake::Task['spec'].execute
35
+ end
36
+
37
+ require 'bundler/audit/cli'
38
+ task :bundler_audit do
39
+ %w[update check].each do |command|
40
+ Bundler::Audit::CLI.start [command]
41
+ end
42
+ end
43
+
44
+ require 'rubocop/rake_task'
45
+ RuboCop::RakeTask.new(:rubocop)
46
+
47
+ task default: %i[rubocop simplecov bundler_audit]
48
+
49
+ require 'rdoc/task'
50
+ Rake::RDocTask.new do |rdoc|
51
+ version = File.exist?('VERSION') ? File.read('VERSION') : ''
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "signalwire-client #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0.rc1
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Signalwire::REST
4
+ class Client < Twilio::REST::Client
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Signalwire
4
+ module Sdk
5
+ class Configuration
6
+ attr_accessor :hostname
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Twilio
4
+ module REST
5
+ class Domain
6
+ def absolute_url(uri)
7
+ "#{@base_url.chomp('/')}/#{uri.chomp('/').gsub(%r{^/(api/)/}, '')}"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Twilio
4
+ module REST
5
+ class Api < Domain
6
+ def initialize(twilio)
7
+ super
8
+
9
+ @host = ENV['SIGNALWIRE_API_HOSTNAME'] || Signalwire::Sdk.configuration.hostname || raise(ArgumentError,
10
+ 'Signalwire API Hostname is not configured. Enter your Signalwire hostname via the '\
11
+ 'SIGNALWIRE_API_HOSTNAME environment variable, or hostname in the configuration.')
12
+ @base_url = "https://#{@host}/api"
13
+ @port = 443
14
+
15
+ # Versions
16
+ @v2010 = nil
17
+ end
18
+
19
+ def hostname
20
+ @host
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Signalwire::Sdk
4
+ class VoiceResponse < Twilio::TwiML::VoiceResponse
5
+ end
6
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'twilio-ruby'
4
+
5
+ require 'signalwire/sdk/configuration'
6
+ require 'signalwire/sdk/twilio_set_host'
7
+ require 'signalwire/sdk/domain'
8
+ require 'signalwire/sdk/voice_response'
9
+ require 'signalwire/rest/client'
10
+
11
+ module Signalwire
12
+ module Sdk
13
+ class << self
14
+ def configuration
15
+ @configuration ||= Configuration.new
16
+ end
17
+
18
+ def configure
19
+ yield(configuration)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,90 @@
1
+ # Generated by juwelier
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: signalwire 1.0.0.rc1 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "signalwire".freeze
9
+ s.version = "1.0.0.rc1"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["SignalWire Team".freeze]
14
+ s.date = "2018-09-21"
15
+ s.email = "open.source@signalwire.com".freeze
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rspec",
23
+ ".rubocop.yml",
24
+ "AUTHORS.md",
25
+ "Gemfile",
26
+ "Gemfile.lock",
27
+ "Guardfile",
28
+ "LICENSE.txt",
29
+ "Makefile",
30
+ "README.md",
31
+ "Rakefile",
32
+ "VERSION",
33
+ "lib/signalwire/rest/client.rb",
34
+ "lib/signalwire/sdk.rb",
35
+ "lib/signalwire/sdk/configuration.rb",
36
+ "lib/signalwire/sdk/domain.rb",
37
+ "lib/signalwire/sdk/twilio_set_host.rb",
38
+ "lib/signalwire/sdk/voice_response.rb",
39
+ "signalwire.gemspec",
40
+ "spec/signalwire/rest/client_spec.rb",
41
+ "spec/signalwire/sdk/configuration_spec.rb",
42
+ "spec/signalwire/sdk/voice_response_spec.rb",
43
+ "spec/signalwire/sdk_spec.rb",
44
+ "spec/spec_helper.rb"
45
+ ]
46
+ s.homepage = "http://github.com/signalwire/signalwire-ruby".freeze
47
+ s.licenses = ["MIT".freeze]
48
+ s.rubygems_version = "2.7.3".freeze
49
+ s.summary = "Ruby client for Signalwire".freeze
50
+
51
+ if s.respond_to? :specification_version then
52
+ s.specification_version = 4
53
+
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
+ s.add_runtime_dependency(%q<twilio-ruby>.freeze, ["~> 5.0"])
56
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
57
+ s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
58
+ s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
59
+ s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
60
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
61
+ s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
62
+ s.add_development_dependency(%q<bundler-audit>.freeze, [">= 0"])
63
+ s.add_development_dependency(%q<guard-rspec>.freeze, [">= 0"])
64
+ s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
65
+ else
66
+ s.add_dependency(%q<twilio-ruby>.freeze, ["~> 5.0"])
67
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
68
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
69
+ s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
70
+ s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
71
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
72
+ s.add_dependency(%q<rubocop>.freeze, [">= 0"])
73
+ s.add_dependency(%q<bundler-audit>.freeze, [">= 0"])
74
+ s.add_dependency(%q<guard-rspec>.freeze, [">= 0"])
75
+ s.add_dependency(%q<webmock>.freeze, [">= 0"])
76
+ end
77
+ else
78
+ s.add_dependency(%q<twilio-ruby>.freeze, ["~> 5.0"])
79
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
80
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
81
+ s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
82
+ s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
83
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
84
+ s.add_dependency(%q<rubocop>.freeze, [">= 0"])
85
+ s.add_dependency(%q<bundler-audit>.freeze, [">= 0"])
86
+ s.add_dependency(%q<guard-rspec>.freeze, [">= 0"])
87
+ s.add_dependency(%q<webmock>.freeze, [">= 0"])
88
+ end
89
+ end
90
+
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ module Signalwire
6
+ RSpec.describe REST::Client do
7
+ it 'makes the correct request' do
8
+ Signalwire::Sdk.configure do |config|
9
+ config.hostname = 'lpradovera.signalwire.com'
10
+ end
11
+
12
+ @client = Signalwire::REST::Client.new '29bba2d4-ddf1-4569-8b4a-5914440a5e13',
13
+ 'PT23d3ccf519d347eb0492c48eec7e1f2dbcfdeba7d7b13e68'
14
+
15
+ stub = stub_request(:post, 'https://lpradovera.signalwire.com/api/2010-04-01/Accounts/29bba2d4-ddf1-4569-8b4a-5914440a5e13/Messages.json')
16
+ .with(body: { 'Body' => 'This is a message from the Signalwire-Ruby library!',
17
+ 'From' => '+14043287360', 'To' => '+14043287174' })
18
+
19
+ @message = @client.messages.create(
20
+ from: '+14043287360',
21
+ to: '+14043287174',
22
+ body: 'This is a message from the Signalwire-Ruby library!'
23
+ )
24
+
25
+ expect(stub).to have_been_requested
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ module Signalwire
6
+ RSpec.describe Sdk::Configuration do
7
+ describe '#hostname' do
8
+ it 'there is no default' do
9
+ expect(Sdk::Configuration.new.hostname).to eq nil
10
+ end
11
+ end
12
+
13
+ describe '#hostname=' do
14
+ it 'can set value' do
15
+ config = Sdk::Configuration.new
16
+ config.hostname = 'test.signalwire.com'
17
+ expect(config.hostname).to eq('test.signalwire.com')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ module Signalwire
6
+ RSpec.describe Sdk::VoiceResponse do
7
+ it 'generates the correct LAML' do
8
+ response = Signalwire::Sdk::VoiceResponse.new do |r|
9
+ r.say(message: 'hello there', voice: 'alice')
10
+ r.dial(caller_id: '+14159992222') do |d|
11
+ d.client 'jenny'
12
+ end
13
+ end
14
+
15
+ expect(response.to_s).to eq "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n"\
16
+ "<Say voice=\"alice\">hello there</Say>\n<Dial callerId=\"+14159992222\">\n"\
17
+ "<Client>jenny</Client>\n</Dial>\n</Response>\n"
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Signalwire::Sdk do
6
+ describe '#configure' do
7
+ it 'returns the configured hostname' do
8
+ Signalwire::Sdk.configure do |config|
9
+ config.hostname = 'demo.signalwire.com'
10
+ end
11
+
12
+ twilio_client = Twilio::REST::Client.new
13
+ expect(twilio_client.api.hostname).to eq('demo.signalwire.com')
14
+ end
15
+
16
+ it 'requires the hostname configuration to be set' do
17
+ Signalwire::Sdk.configure do |config|
18
+ config.hostname = nil
19
+ end
20
+
21
+ expect do
22
+ Twilio::REST::Client.new.api
23
+ end.to raise_exception ArgumentError, /Signalwire API Hostname is not configured/
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+
6
+ %w[
7
+ bundler/setup
8
+ signalwire/sdk
9
+ webmock/rspec
10
+ ].each { |f| require f }
11
+
12
+ # This file was generated by the `rspec --init` command. Conventionally, all
13
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
14
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
15
+ # this file to always be loaded, without a need to explicitly require it in any
16
+ # files.
17
+ #
18
+ # Given that it is always loaded, you are encouraged to keep this file as
19
+ # light-weight as possible. Requiring heavyweight dependencies from this file
20
+ # will add to the boot time of your test suite on EVERY test run, even for an
21
+ # individual file that may not need all of that loaded. Instead, consider making
22
+ # a separate helper file that requires the additional dependencies and performs
23
+ # the additional setup, and require it from the spec files that actually need
24
+ # it.
25
+ #
26
+ # The `.rspec` file also contains a few flags that are not defaults but that
27
+ # users commonly want.
28
+ #
29
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
30
+ RSpec.configure do |config|
31
+ # rspec-expectations config goes here. You can use an alternate
32
+ # assertion/expectation library such as wrong or the stdlib/minitest
33
+ # assertions if you prefer.
34
+ config.expect_with :rspec do |expectations|
35
+ # This option will default to `true` in RSpec 4. It makes the `description`
36
+ # and `failure_message` of custom matchers include text for helper methods
37
+ # defined using `chain`, e.g.:
38
+ # be_bigger_than(2).and_smaller_than(4).description
39
+ # # => "be bigger than 2 and smaller than 4"
40
+ # ...rather than:
41
+ # # => "be bigger than 2"
42
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
43
+ end
44
+
45
+ # rspec-mocks config goes here. You can use an alternate test double
46
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
47
+ config.mock_with :rspec do |mocks|
48
+ # Prevents you from mocking or stubbing a method that does not exist on
49
+ # a real object. This is generally recommended, and will default to
50
+ # `true` in RSpec 4.
51
+ mocks.verify_partial_doubles = true
52
+ end
53
+
54
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
55
+ # have no way to turn it off -- the option exists only for backwards
56
+ # compatibility in RSpec 3). It causes shared context metadata to be
57
+ # inherited by the metadata hash of host groups and examples, rather than
58
+ # triggering implicit auto-inclusion in groups with matching metadata.
59
+ config.shared_context_metadata_behavior = :apply_to_host_groups
60
+
61
+ # The settings below are suggested to provide a good initial experience
62
+ # with RSpec, but feel free to customize to your heart's content.
63
+ # # This allows you to limit a spec run to individual examples or groups
64
+ # # you care about by tagging them with `:focus` metadata. When nothing
65
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
66
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
67
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
68
+ # config.filter_run_when_matching :focus
69
+ #
70
+ # # Allows RSpec to persist some state between runs in order to support
71
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
72
+ # # you configure your source control system to ignore this file.
73
+ # config.example_status_persistence_file_path = "spec/examples.txt"
74
+ #
75
+ # # Limits the available syntax to the non-monkey patched syntax that is
76
+ # # recommended. For more details, see:
77
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
78
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
79
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
80
+ # config.disable_monkey_patching!
81
+ #
82
+ # # This setting enables warnings. It's recommended, but in some cases may
83
+ # # be too noisy due to issues in dependencies.
84
+ # config.warnings = true
85
+ #
86
+ # # Many RSpec users commonly either run the entire suite or an individual
87
+ # # file, and it's useful to allow more verbose output when running an
88
+ # # individual spec file.
89
+ # if config.files_to_run.one?
90
+ # # Use the documentation formatter for detailed output,
91
+ # # unless a formatter has already been configured
92
+ # # (e.g. via a command-line flag).
93
+ # config.default_formatter = 'doc'
94
+ # end
95
+ #
96
+ # # Print the 10 slowest examples and example groups at the
97
+ # # end of the spec run, to help surface which specs are running
98
+ # # particularly slow.
99
+ # config.profile_examples = 10
100
+ #
101
+ # # Run specs in random order to surface order dependencies. If you find an
102
+ # # order dependency and want to debug it, you can fix the order by providing
103
+ # # the seed, which is printed after each run.
104
+ # # --seed 1234
105
+ # config.order = :random
106
+ #
107
+ # # Seed global randomization in this process using the `--seed` CLI option.
108
+ # # Setting this allows you to use `--seed` to deterministically reproduce
109
+ # # test failures related to randomization by passing the same `--seed` value
110
+ # # as the one that triggered the failure.
111
+ # Kernel.srand config.seed
112
+ end
metadata ADDED
@@ -0,0 +1,209 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: signalwire
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.rc1
5
+ platform: ruby
6
+ authors:
7
+ - SignalWire Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: twilio-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.5.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.5.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: juwelier
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.1.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.1.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: bundler-audit
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description:
154
+ email: open.source@signalwire.com
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files:
158
+ - LICENSE.txt
159
+ - README.md
160
+ files:
161
+ - ".document"
162
+ - ".rspec"
163
+ - ".rubocop.yml"
164
+ - AUTHORS.md
165
+ - Gemfile
166
+ - Gemfile.lock
167
+ - Guardfile
168
+ - LICENSE.txt
169
+ - Makefile
170
+ - README.md
171
+ - Rakefile
172
+ - VERSION
173
+ - lib/signalwire/rest/client.rb
174
+ - lib/signalwire/sdk.rb
175
+ - lib/signalwire/sdk/configuration.rb
176
+ - lib/signalwire/sdk/domain.rb
177
+ - lib/signalwire/sdk/twilio_set_host.rb
178
+ - lib/signalwire/sdk/voice_response.rb
179
+ - signalwire.gemspec
180
+ - spec/signalwire/rest/client_spec.rb
181
+ - spec/signalwire/sdk/configuration_spec.rb
182
+ - spec/signalwire/sdk/voice_response_spec.rb
183
+ - spec/signalwire/sdk_spec.rb
184
+ - spec/spec_helper.rb
185
+ homepage: http://github.com/signalwire/signalwire-ruby
186
+ licenses:
187
+ - MIT
188
+ metadata: {}
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">"
201
+ - !ruby/object:Gem::Version
202
+ version: 1.3.1
203
+ requirements: []
204
+ rubyforge_project:
205
+ rubygems_version: 2.7.3
206
+ signing_key:
207
+ specification_version: 4
208
+ summary: Ruby client for Signalwire
209
+ test_files: []