alexa_rubykit 1.2.1 → 1.3.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
  SHA1:
3
- metadata.gz: 8eabfbd8af2def2e5c8da3287f0780a136dcddb7
4
- data.tar.gz: fb8da8a9978f2596ef17834b0ced826d06b6d28c
3
+ metadata.gz: 2bdb573ced8e9c3a6e907e44d2d2f803b6c8baf6
4
+ data.tar.gz: 9fce8086d8e9a97c46643607a8d408e372e9a6b0
5
5
  SHA512:
6
- metadata.gz: 6cb1e0e9ffec21c05eb8fd7f54e1b2d55be7402291b0ee24f91d7b0a2b08ed0edf472933b951683107662f67ad78bc9115481a7f6c0c7c95d982c9a40b4ab74d
7
- data.tar.gz: 45f2d038c9d4b867ea69e611ce3112fd13d4350595583025f0d7f5b25f5a76d4774a053ad29dd3981f4595d687c47cc3a46cdff030e9becec92724ccf385b634
6
+ metadata.gz: 02c7d0c0dca8be917cbd7356e5a87319ba0a930dd45c0cb95247ed4264a134a499bc962c1f87aaf77c215fe699e9566d56c13de308e676fc5ef2a7019e873547
7
+ data.tar.gz: 39b261cfed6aa0523e91a8f72a3e60643aaea153b303d147979a3cdd01bfd7d8e444d095de30a5fffc7ca73d6e9fbb8cb94ae14a9f79019aecd008bd341fec0d
@@ -1,18 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- alexa_rubykit (0.0.12.pre.dev)
4
+ alexa_rubykit (1.2.1)
5
5
  bundler (~> 1.7)
6
- rake (~> 10.0)
7
- sinatra (~> 1.4)
6
+ rake
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
11
10
  specs:
12
11
  diff-lcs (1.2.5)
13
- rack (1.6.1)
14
- rack-protection (1.5.3)
15
- rack
16
12
  rake (10.4.2)
17
13
  rspec (3.2.0)
18
14
  rspec-core (~> 3.2.0)
@@ -27,16 +23,11 @@ GEM
27
23
  diff-lcs (>= 1.2.0, < 2.0)
28
24
  rspec-support (~> 3.2.0)
29
25
  rspec-support (3.2.2)
30
- sinatra (1.4.6)
31
- rack (~> 1.4)
32
- rack-protection (~> 1.4)
33
- tilt (>= 1.3, < 3)
34
- tilt (2.0.1)
35
26
 
36
27
  PLATFORMS
37
28
  ruby
38
29
 
39
30
  DEPENDENCIES
40
31
  alexa_rubykit!
41
- rspec (~> 3.2.0)
42
- rspec-mocks (~> 3.2.0)
32
+ rspec (~> 3.2, >= 3.2.0)
33
+ rspec-mocks (~> 3.2, >= 3.2.0)
data/README.md CHANGED
@@ -65,6 +65,14 @@ the management console.
65
65
  - "Error in SSL handshake" : Make sure your used the FQDN when you generated the SSL and it's also the active SSL in EBS.
66
66
  - "Error communicating with the application" : Query the EBS logs from the management console and create an issue on GitHub.
67
67
 
68
+ ## Testing
69
+
70
+ Run the tests using
71
+
72
+ ```bash
73
+ bundle exec rake
74
+ ```
75
+
68
76
  ## Contributing
69
77
 
70
78
  1. Decide to work on the "dev" (unstable) branch or "master" (stable)
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
2
3
 
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => [:spec]
@@ -16,8 +16,12 @@ module AlexaRubykit
16
16
  @session_attributes[key.to_sym] = value
17
17
  end
18
18
 
19
- def add_speech(speech_text)
20
- @speech = { :type => 'PlainText', :text => speech_text }
19
+ def add_speech(speech_text, ssml = false)
20
+ if ssml
21
+ @speech = { :type => 'SSML', :ssml => check_ssml(speech_text) }
22
+ else
23
+ @speech = { :type => 'PlainText', :text => speech_text }
24
+ end
21
25
  @speech
22
26
  end
23
27
 
@@ -35,8 +39,12 @@ module AlexaRubykit
35
39
  }
36
40
  end
37
41
 
38
- def add_reprompt(speech_text)
39
- @reprompt = { "outputSpeech" => { :type => 'PlainText', :text => speech_text } }
42
+ def add_reprompt(speech_text, ssml = false)
43
+ if ssml
44
+ @reprompt = { "outputSpeech" => { :type => 'SSML', :ssml => check_ssml(speech_text) } }
45
+ else
46
+ @reprompt = { "outputSpeech" => { :type => 'PlainText', :text => speech_text } }
47
+ end
40
48
  @reprompt
41
49
  end
42
50
 
@@ -63,15 +71,15 @@ module AlexaRubykit
63
71
  end
64
72
 
65
73
  # Adds a speech to the object, also returns a outputspeech object.
66
- def say_response(speech, end_session = true)
67
- output_speech = add_speech(speech)
74
+ def say_response(speech, end_session = true, ssml = false)
75
+ output_speech = add_speech(speech,ssml)
68
76
  { :outputSpeech => output_speech, :shouldEndSession => end_session }
69
77
  end
70
78
 
71
79
  # Incorporates reprompt in the SDK 2015-05
72
- def say_response_with_reprompt(speech, reprompt_speech, end_session = true)
73
- output_speech = add_speech(speech)
74
- reprompt_speech = add_reprompt(reprompt_speech)
80
+ def say_response_with_reprompt(speech, reprompt_speech, end_session = true, speech_ssml = false, reprompt_ssml = false)
81
+ output_speech = add_speech(speech,speech_ssml)
82
+ reprompt_speech = add_reprompt(reprompt_speech,reprompt_ssml)
75
83
  { :outputSpeech => output_speech, :reprompt => reprompt_speech, :shouldEndSession => end_session }
76
84
  end
77
85
 
@@ -112,5 +120,12 @@ module AlexaRubykit
112
120
  def to_s
113
121
  "Version => #{@version}, SessionObj => #{@session}, Response => #{@response}"
114
122
  end
123
+
124
+ private
125
+
126
+ def check_ssml(ssml_string)
127
+ ssml_string = ssml_string.strip[0..6] == "<speak>" ? ssml_string : "<speak>" + ssml_string
128
+ ssml_string.strip[-8..1] == "</speak>" ? ssml_string : ssml_string + "</speak>"
129
+ end
115
130
  end
116
131
  end
@@ -1,3 +1,3 @@
1
1
  module AlexaRubykit
2
- VERSION = '1.2.1'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexa_rubykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Finol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-19 00:00:00.000000000 Z
11
+ date: 2017-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler