alexa_transmission 1.0.1 → 1.1.1

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: 4ba3dd2fc051ffe864e44491a654ed6fef176fae
4
- data.tar.gz: df7afea7bbde79f5e8c2f327622ff3dcb8eccb2e
3
+ metadata.gz: 82680284e5a7e45464f7d22d9a21d215a948570d
4
+ data.tar.gz: 73aa685a0b858726958d07d6c483d236223f16eb
5
5
  SHA512:
6
- metadata.gz: b59462d18364cabb8aae3cce3b67b748142531f4f35b3c602f3edb8e26e8bd714c1a9cbc9e0e90896ccab99a0823ac738f8e70e329bb310246df10a523a57309
7
- data.tar.gz: 938fc69a2bc31b8ce3b0b99a28d2c1e74efcd8069f798d38f5e19c6f071cb13110a64025eb0742380fc4980d5b49dc142fa2db41da5a852a6eb5533eb6e94a26
6
+ metadata.gz: 13b0870f7741d53000d5e610b68dd18c4e251a5f6a2e9a8182b552d46a326d0da348eb4f6c5e0be395386752fae295dd8db11a80818f16d594e1321bc69cd789
7
+ data.tar.gz: 663bb70023e781f394031e6c36a93aafec452200ad6b3dd19c9320fc3dd9ea9d737013fecbea681cd87379025e77e2cf5abc38cb332ad5a5b547949e2cf5f5b1
@@ -5,7 +5,7 @@ require 'alexa_transmission/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "alexa_transmission"
8
- spec.version = AlexaTransmission::VERSION
8
+ spec.version = Transmission::VERSION
9
9
  spec.authors = ["kylegrantlucas"]
10
10
  spec.email = ["kglucas93@gmail.com"]
11
11
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'toname'
24
24
  spec.add_runtime_dependency 'transmission_api'
25
25
  spec.add_runtime_dependency 'activesupport'
26
- spec.add_runtime_dependency 'sinatra'
26
+ spec.add_runtime_dependency 'sinatra-contrib'
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 1.11"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,52 +1,23 @@
1
- Bundler.require
2
1
  require "alexa_transmission/version"
3
2
  require 'transmission_api'
4
- require 'sinatra/base'
5
3
  require 'to_name'
6
4
  require 'active_support/core_ext/array'
5
+ require 'sinatra/extension'
7
6
 
8
- module Sinatra
9
- module Transmission
10
- def self.registered(app)
11
- app.post '/alexa_transmission' do
12
- #halt 400, "" unless settings.config.application_id && @application_id == settings.config.application_id
7
+ module Transmission
8
+ extend Sinatra::Extension
13
9
 
14
- if @echo_request.launch_request?
15
- response = AlexaObjects::Response.new
16
- response.spoken_response = "I'm ready to check your downloads."
17
- response.end_session = false
18
- response.without_card.to_json
19
- puts @echo_request.slots
20
- elsif @echo_request.intent_name == "CheckTransmission"
21
- transmission_api_client = ::TransmissionApi::Client.new(
22
- :username => settings.config.transmission.username,
23
- :password => settings.config.transmission.password,
24
- :url => settings.config.transmission.rpc_url
25
- )
10
+ helpers do
11
+ def check_transmission
12
+ transmission_api_client = ::TransmissionApi::Client.new(
13
+ :username => settings.config.transmission.username,
14
+ :password => settings.config.transmission.password,
15
+ :url => settings.config.transmission.rpc_url
16
+ )
26
17
 
27
- parsed_files = transmission_api_client.all.map{|x| {percent_completed: x["percentDone"], name: ToName.to_name(x["name"].gsub(/\+/, '.').gsub(' ', '.'))} if x["percentDone"] != 1}.compact
28
-
29
- parsed_strings = parsed_files.map {|x| "#{x[:name].name}#{" Episode #{x[:name].episode}" if x[:name].episode} is at #{x[:percent_completed]*100} percent" }.to_sentence
30
-
31
- response = AlexaObjects::Response.new
32
- response.end_session = true
33
- response.spoken_response = parsed_strings
34
-
35
- response.without_card.to_json
36
- elsif @echo_request.intent_name == "EndSession"
37
- puts @echo_request.slots
38
- response = AlexaObjects::Response.new
39
- response.end_session = true
40
- response.spoken_response = "exiting couchpoato"
41
- response.without_card.to_json
42
- elsif @echo_request.session_ended_request?
43
- response = AlexaObjects::Response.new
44
- response.end_session = true
45
- response.without_card.to_json
46
- end
47
- end
18
+ parsed_files = transmission_api_client.all.map{|x| {percent_completed: x["percentDone"], name: ToName.to_name(x["name"].gsub(/\+/, '.').gsub(' ', '.'))} if x["percentDone"] != 1}.compact
19
+ parsed_strings = parsed_files.map {|x| "#{x[:name].name}#{" Episode #{x[:name].episode}" if x[:name].episode} is at #{(x[:percent_completed]*100).round} percent" }.to_sentence
20
+ AlexaObjects::Response.new(spoken_response: parsed_strings).to_json
48
21
  end
49
22
  end
50
-
51
- register Transmission
52
23
  end
@@ -0,0 +1,5 @@
1
+ module Transmission
2
+ def self.custom_slots
3
+ File.read(File.expand_path('../../../skills_config/custom_slots.txt', __FILE__))
4
+ end
5
+ end
@@ -1,7 +1,5 @@
1
- module Sinatra
2
- module Transmission
3
- def self.intent_schema
4
- File.read(File.expand_path('../../../skills_config/intent_schema.txt', __FILE__))
5
- end
1
+ module Transmission
2
+ def self.intent_schema
3
+ File.read(File.expand_path('../../../skills_config/intent_schema.txt', __FILE__))
6
4
  end
7
- end
5
+ end
@@ -1,7 +1,5 @@
1
- module Sinatra
2
- module Transmission
3
- def self.sample_utterances
4
- File.read(File.expand_path('../../../skills_config/sample_utterances.txt', __FILE__))
5
- end
1
+ module Transmission
2
+ def self.sample_utterances
3
+ File.read(File.expand_path('../../../skills_config/sample_utterances.txt', __FILE__))
6
4
  end
7
- end
5
+ end
@@ -1,3 +1,3 @@
1
- module AlexaTransmission
2
- VERSION = "1.0.1"
1
+ module Transmission
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexa_transmission
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kylegrantlucas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-14 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alexa_objects
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: sinatra
70
+ name: sinatra-contrib
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -141,8 +141,7 @@ files:
141
141
  - bin/console
142
142
  - bin/setup
143
143
  - lib/alexa_transmission.rb
144
- - lib/alexa_transmission/custom_schema.rb
145
- - lib/alexa_transmission/endpoint.rb
144
+ - lib/alexa_transmission/custom_slots.rb
146
145
  - lib/alexa_transmission/intent_schema.rb
147
146
  - lib/alexa_transmission/sample_utterances.rb
148
147
  - lib/alexa_transmission/version.rb
@@ -1,7 +0,0 @@
1
- module Sinatra
2
- module Transmission
3
- def self.custom_schema
4
- File.read(File.expand_path('../../../skills_config/custom_schema.txt', __FILE__))
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Sinatra
2
- module Transmission
3
- def self.endpoint
4
- '/alexa_transmission'
5
- end
6
- end
7
- end