alexa-smapi 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 93bd4d60f17d0506c337b3ec323f01baafd08eaec1209588288d4d5a19299559
4
+ data.tar.gz: 265768f77f1ebd5a2d648a3552776e6df99e882a45283590e3c9e2aceee9a83c
5
+ SHA512:
6
+ metadata.gz: bb39727b29d954f63d39091991c0435fd0c4a407fdaf66d395edf6ff2e68d9d1131d567e9b74b12a54222c5f095bd306109bbb38607ddf223849ce78c6f340c7
7
+ data.tar.gz: 0a5818ea31fde3cfb2e65b0f10af1be2959bbab747ff03d7c2364d6969bdc1b237818b372c3af518b09cb1f28d64ccfbd68e279610f6b957d4c74387995f18dd
@@ -0,0 +1,68 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ - image: circleci/ruby:2.5.3-node-browsers
10
+
11
+ working_directory: ~/repo
12
+
13
+ steps:
14
+ - checkout
15
+
16
+ # Download and cache dependencies
17
+ - restore_cache:
18
+ keys:
19
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
20
+ # fallback to using the latest cache if no exact match is found
21
+ - v1-dependencies-
22
+
23
+ - run:
24
+ name: install dependencies
25
+ command: |
26
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
27
+
28
+ - save_cache:
29
+ paths:
30
+ - ./vendor/bundle
31
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
32
+
33
+ - run:
34
+ name: Tests
35
+ command: bundle exec rake test
36
+ when: always
37
+
38
+ - store_test_results:
39
+ path: test/reports
40
+ deploy:
41
+ docker:
42
+ - image: circleci/ruby:2.5.3-node-browsers
43
+
44
+ working_directory: ~/repo
45
+
46
+ steps:
47
+ - checkout
48
+ - run:
49
+ name: Setup Rubygems
50
+ command: bash .circleci/setup-rubygems.sh
51
+
52
+ - run:
53
+ name: Publish to Rubygems
54
+ command: |
55
+ gem build alexa-smapi.gemspec
56
+ gem push "alexa-smapi-$(git describe --tags).gem"
57
+
58
+ workflows:
59
+ version: 2
60
+ test-deploy:
61
+ jobs:
62
+ - build
63
+ - deploy:
64
+ filters:
65
+ tags:
66
+ only: /.*/
67
+ branches:
68
+ ignore: /.*/
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ mkdir ~/.gem
3
+ echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
4
+ chmod 0600 /home/circleci/.gem/credentials
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 1.17.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at stephen@stephen-robinson.co.uk. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in alexa-smapi.gemspec
6
+ gemspec
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ alexa-smapi (0.1.0)
5
+ oauth2 (~> 1.4.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.6.0)
11
+ public_suffix (>= 2.0.2, < 4.0)
12
+ crack (0.4.3)
13
+ safe_yaml (~> 1.0.0)
14
+ docile (1.3.1)
15
+ faraday (0.15.3)
16
+ multipart-post (>= 1.2, < 3)
17
+ hashdiff (0.3.8)
18
+ json (2.2.0)
19
+ jwt (2.1.0)
20
+ metaclass (0.0.4)
21
+ minitest (5.11.3)
22
+ minitest-ci (3.4.0)
23
+ minitest (>= 5.0.6)
24
+ mocha (1.8.0)
25
+ metaclass (~> 0.0.1)
26
+ multi_json (1.13.1)
27
+ multi_xml (0.6.0)
28
+ multipart-post (2.0.0)
29
+ oauth2 (1.4.1)
30
+ faraday (>= 0.8, < 0.16.0)
31
+ jwt (>= 1.0, < 3.0)
32
+ multi_json (~> 1.3)
33
+ multi_xml (~> 0.5)
34
+ rack (>= 1.2, < 3)
35
+ public_suffix (3.0.3)
36
+ rack (2.0.6)
37
+ rake (10.5.0)
38
+ safe_yaml (1.0.5)
39
+ simplecov (0.16.1)
40
+ docile (~> 1.1)
41
+ json (>= 1.8, < 3)
42
+ simplecov-html (~> 0.10.0)
43
+ simplecov-html (0.10.2)
44
+ vcr (4.0.0)
45
+ webmock (3.5.1)
46
+ addressable (>= 2.3.6)
47
+ crack (>= 0.3.2)
48
+ hashdiff
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ alexa-smapi!
55
+ bundler (~> 1.17)
56
+ minitest (~> 5.0)
57
+ minitest-ci (~> 3.4.0)
58
+ mocha (~> 1.8.0)
59
+ rake (~> 10.0)
60
+ simplecov (~> 0.16.1)
61
+ vcr (~> 4.0.0)
62
+ webmock (~> 3.5.1)
63
+
64
+ BUNDLED WITH
65
+ 1.17.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Stephen Robinson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Alexa::Smapi
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/alexa/smapi`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'alexa-smapi'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install alexa-smapi
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/alexa-smapi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Alexa::Smapi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/alexa-smapi/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,49 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "alexa/smapi/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "alexa-smapi"
8
+ spec.version = Alexa::SMAPI::VERSION
9
+ spec.authors = ["Stephen Robinson"]
10
+ spec.email = ["opensource@stephenrob.dev"]
11
+
12
+ spec.summary = %q{Amazon Alexa Skill Management API Client}
13
+ spec.description = %q{}
14
+ spec.homepage = "https://github.com/stephenrob/alexa-smapi"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ spec.metadata["source_code_uri"] = "https://github.com/stephenrob/alexa-smapi"
24
+ spec.metadata["changelog_uri"] = "https://github.com/stephenrob/alexa-smapi"
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_development_dependency "bundler", "~> 1.17"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+ spec.add_development_dependency "minitest", "~> 5.0"
42
+ spec.add_development_dependency "simplecov", "~> 0.16.1"
43
+ spec.add_development_dependency "mocha", "~> 1.8.0"
44
+ spec.add_development_dependency "vcr", "~> 4.0.0"
45
+ spec.add_development_dependency "webmock", "~> 3.5.1"
46
+ spec.add_development_dependency "minitest-ci", "~> 3.4.0"
47
+
48
+ spec.add_dependency "oauth2", "~> 1.4.1"
49
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "alexa/smapi"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+ require "alexa/smapi/version"
2
+ require "alexa/smapi/client"
3
+
4
+ module Alexa
5
+ module SMAPI
6
+ class Error < StandardError; end
7
+ end
8
+ end
@@ -0,0 +1,62 @@
1
+ require 'oauth2'
2
+ require 'alexa/smapi/endpoints/skill_management'
3
+ require 'alexa/smapi/endpoints/interaction_model_management'
4
+ require 'alexa/smapi/endpoints/account_linking_management'
5
+ require 'alexa/smapi/endpoints/beta_test_management'
6
+ require 'alexa/smapi/endpoints/skill_validation'
7
+ require 'alexa/smapi/endpoints/vendor_management'
8
+
9
+ module Alexa
10
+ module SMAPI
11
+
12
+ class Client < ::OAuth2::AccessToken
13
+
14
+ include Endpoints::SkillManagement
15
+ include Endpoints::InteractionModelManagement
16
+ include Endpoints::AccountLinkingManagement
17
+ include Endpoints::BetaTestManagement
18
+ include Endpoints::SkillValidation
19
+ include Endpoints::VendorManagement
20
+
21
+ def initialize client_id, client_secret, refresh_token
22
+
23
+ Faraday::Utils.default_params_encoder = Faraday::FlatParamsEncoder
24
+
25
+ oauth2 = OAuth2::Client.new client_id,
26
+ client_secret,
27
+ :site => "https://api.amazonalexa.com/",
28
+ :authorize_url => "https://www.amazon.com/ap/oa",
29
+ :token_url => "https://api.amazon.com/auth/o2/token",
30
+ :header_format => "%s"
31
+
32
+ params = {
33
+ refresh_token: refresh_token,
34
+ header_format: "%s"
35
+ }
36
+
37
+ super(oauth2, '', params)
38
+
39
+ new_token = self.refresh!
40
+
41
+ @token = new_token.token
42
+ @expires_in = new_token.expires_in.to_i
43
+ @expires_at = new_token.expires_at.to_i
44
+
45
+ end
46
+
47
+ def refresh_token!
48
+
49
+ new_token = self.refresh!
50
+
51
+ @token = new_token.token
52
+ @expires_in = new_token.expires_in.to_i
53
+ @expires_at = new_token.expires_at.to_i
54
+
55
+ @token
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+ end
@@ -0,0 +1,39 @@
1
+ module Alexa
2
+
3
+ module SMAPI
4
+
5
+ module Endpoints
6
+
7
+ module AccountLinkingManagement
8
+
9
+ def get_account_linking_information skill_id, stage='development'
10
+
11
+ endpoint = "/v1/skills/#{skill_id}/stages/#{stage}/accountLinkingClient"
12
+
13
+ get(endpoint)
14
+
15
+ end
16
+
17
+ def update_account_linking skill_id, body, stage='development'
18
+
19
+ endpoint = "/v1/skills/#{skill_id}/stages/#{stage}/accountLinkingClient"
20
+
21
+ put(endpoint, {body: body.to_json})
22
+
23
+ end
24
+
25
+ def delete_account_linking_partner skill_id
26
+
27
+ endpoint = "/v1/skills/#{skill_id}/stages/development/accountLinkingClient"
28
+
29
+ delete(endpoint)
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,207 @@
1
+ module Alexa
2
+
3
+ module SMAPI
4
+
5
+ module Endpoints
6
+
7
+ module BetaTestManagement
8
+
9
+ def create_beta_test skill_id, feedback_email
10
+
11
+ endpoint = "/v1/skills/#{skill_id}/betaTest"
12
+
13
+ post(endpoint, {body:{"feedbackEmail": feedback_email}})
14
+
15
+ end
16
+
17
+ def get_beta_test skill_id
18
+
19
+ endpoint = "/v1/skills/#{skill_id}/betaTest"
20
+
21
+ get(endpoint)
22
+
23
+ end
24
+
25
+ def update_beta_test skill_id, feedback_email
26
+
27
+ endpoint = "/v1/skills/#{skill_id}/betaTest"
28
+
29
+ put(endpoint, {body:{"feedbackEmail": feedback_email}})
30
+
31
+ end
32
+
33
+ def start_beta_test skill_id
34
+
35
+ endpoint = "/v1/skills/#{skill_id}/betaTest/start"
36
+
37
+ post(endpoint)
38
+
39
+ end
40
+
41
+ def end_beta_test skill_id
42
+
43
+ endpoint = "/v1/skills/#{skill_id}/betaTest/end"
44
+
45
+ post(endpoint)
46
+
47
+ end
48
+
49
+ def get_beta_testers skill_id, max_results=nil, next_token=nil
50
+
51
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers"
52
+
53
+ if !max_results.nil? && !max_results.empty?
54
+ endpoint += "&maxResults=#{max_results}"
55
+ end
56
+
57
+ if !next_token.nil? && !next_token.empty?
58
+ endpoint += "&nextToken=#{next_token}"
59
+ end
60
+
61
+ get(endpoint)
62
+
63
+ end
64
+
65
+ def add_beta_tester skill_id, email_id
66
+
67
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers/add"
68
+
69
+ body = {
70
+ "testers": [
71
+ {
72
+ "emailId": email_id
73
+ }
74
+ ]
75
+ }
76
+
77
+ post(endpoint, {body: body})
78
+
79
+ end
80
+
81
+ def add_beta_testers skill_id, email_ids=[]
82
+
83
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers/add"
84
+
85
+ testers = []
86
+
87
+ email_ids.each do |email|
88
+ testers.append({"emailId": email})
89
+ end
90
+
91
+ body = {
92
+ "testers": testers
93
+ }
94
+
95
+ post(endpoint, {body: body})
96
+
97
+ end
98
+
99
+ def remove_beta_tester skill_id, email_id
100
+
101
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers/remove"
102
+
103
+ body = {
104
+ "testers": [
105
+ {
106
+ "emailId": email_id
107
+ }
108
+ ]
109
+ }
110
+
111
+ post(endpoint, {body: body})
112
+
113
+ end
114
+
115
+ def remove_beta_testers skill_id, email_ids=[]
116
+
117
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers/remove"
118
+
119
+ testers = []
120
+
121
+ email_ids.each do |email|
122
+ testers.append({"emailId": email})
123
+ end
124
+
125
+ body = {
126
+ "testers": testers
127
+ }
128
+
129
+ post(endpoint, {body: body})
130
+
131
+ end
132
+
133
+ def send_reminder_to_tester skill_id, email_id
134
+
135
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers/sendReminder"
136
+
137
+ body = {
138
+ "testers": [
139
+ {
140
+ "emailId": email_id
141
+ }
142
+ ]
143
+ }
144
+
145
+ post(endpoint, {body: body})
146
+
147
+ end
148
+
149
+ def send_reminder_to_testers skill_id, email_ids=[]
150
+
151
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers/sendReminder"
152
+
153
+ testers = []
154
+
155
+ email_ids.each do |email|
156
+ testers.append({"emailId": email})
157
+ end
158
+
159
+ body = {
160
+ "testers": testers
161
+ }
162
+
163
+ post(endpoint, {body: body})
164
+
165
+ end
166
+
167
+ def request_feedback_from_tester skill_id, email_id
168
+
169
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers/requestFeedback"
170
+
171
+ body = {
172
+ "testers": [
173
+ {
174
+ "emailId": email_id
175
+ }
176
+ ]
177
+ }
178
+
179
+ post(endpoint, {body: body})
180
+
181
+ end
182
+
183
+ def request_feedback_from_testers skill_id, email_ids=[]
184
+
185
+ endpoint = "/v1/skills/#{skill_id}/betaTest/testers/requestFeedback"
186
+
187
+ testers = []
188
+
189
+ email_ids.each do |email|
190
+ testers.append({"emailId": email})
191
+ end
192
+
193
+ body = {
194
+ "testers": testers
195
+ }
196
+
197
+ post(endpoint, {body: body})
198
+
199
+ end
200
+
201
+ end
202
+
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,31 @@
1
+ module Alexa
2
+
3
+ module SMAPI
4
+
5
+ module Endpoints
6
+
7
+ module InteractionModelManagement
8
+
9
+ def get_interaction_model skill_id, stage='development', locale='en-US'
10
+
11
+ endpoint = "/v1/skills/#{skill_id}/stages/#{stage}/interactionModel/locales/#{locale}"
12
+
13
+ get(endpoint)
14
+
15
+ end
16
+
17
+ def update_interaction_model skill_id, manifest, stage='development', locale='en-US'
18
+
19
+ endpoint = "/v1/skills/#{skill_id}/stages/#{stage}/interactionModel/locales/#{locale}"
20
+
21
+ put(endpoint, {body: manifest.to_json})
22
+
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,87 @@
1
+ module Alexa
2
+
3
+ module SMAPI
4
+
5
+ module Endpoints
6
+
7
+ module SkillManagement
8
+
9
+ def get_skills vendor_id, skill_ids=[], max_results=nil, next_token=nil
10
+
11
+ endpoint = "/v1/skills?vendorId=#{vendor_id}"
12
+
13
+ if (!skill_ids.nil? && !skill_ids.empty?) && skill_ids.length < 10
14
+
15
+ skill_ids_param = ''
16
+
17
+ skill_ids.each do |id|
18
+ param = "skillId=#{id}"
19
+ skill_ids_param += "&#{param}"
20
+ end
21
+
22
+ endpoint += "#{skill_ids_param}"
23
+
24
+ end
25
+
26
+ if (skill_ids.nil? || skill_ids.empty?) && (!max_results.nil? && !max_results.to_s.empty?)
27
+ endpoint += "&maxResults=#{max_results}"
28
+ end
29
+
30
+ if (skill_ids.nil? || skill_ids.empty?) && (!next_token.nil? && !next_token.empty?)
31
+ endpoint += "&nextToken=#{next_token}"
32
+ end
33
+
34
+ get(endpoint)
35
+ end
36
+
37
+ def get_skill skill_id, stage='development'
38
+
39
+ endpoint = "/v1/skills/#{skill_id}/stages/#{stage}/manifest"
40
+
41
+ get(endpoint)
42
+
43
+ end
44
+
45
+ def create_skill vendor_id, manifest
46
+
47
+ endpoint = '/v1/skills'
48
+
49
+ body = {
50
+ "vendorId": vendor_id,
51
+ }.merge(manifest)
52
+
53
+ post(endpoint, {body: body.to_json})
54
+
55
+ end
56
+
57
+ def update_skill skill_id, manifest
58
+
59
+ endpoint = "/v1/skills/#{skill_id}/stages/development/manifest"
60
+
61
+ put(endpoint, {body: manifest.to_json})
62
+
63
+ end
64
+
65
+ def get_skill_resource_status skill_id, resource='manifest'
66
+
67
+ endpoint = "/v1/skills/#{skill_id}/status?resource=#{resource}"
68
+
69
+ get(endpoint)
70
+
71
+ end
72
+
73
+ def delete_skill skill_id
74
+
75
+ endpoint = "/v1/skills/#{skill_id}"
76
+
77
+ delete(endpoint)
78
+
79
+ end
80
+
81
+ end
82
+
83
+ end
84
+
85
+ end
86
+
87
+ end
@@ -0,0 +1,39 @@
1
+ module Alexa
2
+
3
+ module SMAPI
4
+
5
+ module Endpoints
6
+
7
+ module SkillValidation
8
+
9
+ def validate_skill skill_id, locales=[], stage='development'
10
+
11
+ endpoint = "/v1/skills/#{skill_id}/stages/#{stage}/validations"
12
+
13
+ if locales.nil? && locales.empty?
14
+ locales = ['en-US']
15
+ end
16
+
17
+ body = {
18
+ locales: locales
19
+ }
20
+
21
+ post(endpoint, {body: body})
22
+
23
+ end
24
+
25
+ def get_skill_validation skill_id, validation_id, stage='development'
26
+
27
+ endpoint = "/v1/skills/#{skill_id}/stages/#{stage}/validations/#{validation_id}"
28
+
29
+ get(endpoint)
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,23 @@
1
+ module Alexa
2
+
3
+ module SMAPI
4
+
5
+ module Endpoints
6
+
7
+ module VendorManagement
8
+
9
+ def get_vendors
10
+
11
+ endpoint = "/v1/vendors"
12
+
13
+ get(endpoint)
14
+
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,5 @@
1
+ module Alexa
2
+ module SMAPI
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,195 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alexa-smapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen Robinson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.16.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.16.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.8.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.8.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 4.0.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 4.0.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 3.5.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 3.5.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: minitest-ci
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 3.4.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 3.4.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: oauth2
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.4.1
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.4.1
139
+ description: ''
140
+ email:
141
+ - opensource@stephenrob.dev
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".circleci/config.yml"
147
+ - ".circleci/setup-rubygems.sh"
148
+ - ".gitignore"
149
+ - ".travis.yml"
150
+ - CODE_OF_CONDUCT.md
151
+ - Gemfile
152
+ - Gemfile.lock
153
+ - LICENSE.txt
154
+ - README.md
155
+ - Rakefile
156
+ - alexa-smapi.gemspec
157
+ - bin/console
158
+ - bin/setup
159
+ - lib/alexa/smapi.rb
160
+ - lib/alexa/smapi/client.rb
161
+ - lib/alexa/smapi/endpoints/account_linking_management.rb
162
+ - lib/alexa/smapi/endpoints/beta_test_management.rb
163
+ - lib/alexa/smapi/endpoints/interaction_model_management.rb
164
+ - lib/alexa/smapi/endpoints/skill_management.rb
165
+ - lib/alexa/smapi/endpoints/skill_validation.rb
166
+ - lib/alexa/smapi/endpoints/vendor_management.rb
167
+ - lib/alexa/smapi/version.rb
168
+ homepage: https://github.com/stephenrob/alexa-smapi
169
+ licenses:
170
+ - MIT
171
+ metadata:
172
+ allowed_push_host: https://rubygems.org
173
+ homepage_uri: https://github.com/stephenrob/alexa-smapi
174
+ source_code_uri: https://github.com/stephenrob/alexa-smapi
175
+ changelog_uri: https://github.com/stephenrob/alexa-smapi
176
+ post_install_message:
177
+ rdoc_options: []
178
+ require_paths:
179
+ - lib
180
+ required_ruby_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ requirements: []
191
+ rubygems_version: 3.0.1
192
+ signing_key:
193
+ specification_version: 4
194
+ summary: Amazon Alexa Skill Management API Client
195
+ test_files: []