google_assistant 0.2.0 → 1.0.0.beta

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53efc649d01191b0cfdabc34974a52e124fa8b8d
4
- data.tar.gz: 8668eb3b467923e6db3d1667e7ef1c0bfde46c22
3
+ metadata.gz: 995844f98cf4cf9b7781addf95ddc92a0b5cb9ae
4
+ data.tar.gz: 7787d278be43aa748921fd70c6597c6f35ffe96e
5
5
  SHA512:
6
- metadata.gz: bf5090c145e291632812c652f89f6fb729172def0fb3449413bbff1c262dacc0e6401a7999289a8109931521630113597ace1bc9bc7a26d24eebff8a19c172fb
7
- data.tar.gz: 5faf5231646608ba776b52810d9a29ccae204c418ed04821c571f5b6407aa8846db0c3ad4a1e072ae180c8958bacedd72ff4392b63929295a6c640d7993678c7
6
+ metadata.gz: 364d269cad36246cad439cafcdf88dc29800e171366619c280f0518162a136304505b96ff39d4da519b7bd3535b7d232b9d5ab0e7dfa322a5fbecabed42210a0
7
+ data.tar.gz: c4e46c8cf7ed4d1f27693ff8d5646a526bc0ab7f2fedaffffa4c7d1fed46c480bba0af57658ae327178b7107227cb43fbdb4f4fe0839aa6577dc72511787ac99
data/README.md CHANGED
@@ -291,6 +291,24 @@ You can use any hosting platform.
291
291
 
292
292
  6. Use the [web simulator](https://developers.google.com/actions/tools/web-simulator) to simulate. Or better yet, if your Google Home device is logged into the same account you're using to build your action, you can say "OK Google, talk to my action" to test it out directly on your device.
293
293
 
294
+ ## Authentication
295
+
296
+ You can require users to log in to your service before using your assistant. Read about it in [Google's documentation](https://developers.google.com/actions/develop/identity/oauth2-code-flow). The basic flow is this:
297
+
298
+ 1. User tries to talk to your assistant
299
+ 2. Google tells the user they need to sign in, which they can do via the Home app on their phone
300
+ 3. The Home app links the user to your Oauth endpoint
301
+ 4. User signs in to your app
302
+ 5. Google stores the user's Oauth access and refresh tokens
303
+ 6. For each subsequent request the user makes to your assistant, Google sends the user's access token so you can identify the user
304
+
305
+ In order to set this up in your assistant, the basic instructions are as follows. Read Google's documentation for the full details.
306
+
307
+ 1. Implement Oauth in your application
308
+ 2. Set up an Oauth client in the [Google Developer Console](https://console.developers.google.com)
309
+ 3. In the application's `action.json` file, set up account linking according to [Google's Instructions](https://developers.google.com/actions/develop/identity/account-linking#enabling_account_linking)
310
+ 4. Use `assistant.user.access_token` to identify the user
311
+
294
312
  ## More information
295
313
 
296
314
  Check out Google's instructions at https://developers.google.com/actions/develop/sdk/getting-started for more detail on writing and testing a Google Assistant action.
@@ -1,10 +1,11 @@
1
1
  module GoogleAssistant
2
2
  class User
3
- attr_reader :id, :profile
3
+ attr_reader :id, :profile, :access_token
4
4
 
5
5
  def initialize(opts)
6
6
  @id = opts["user_id"]
7
7
  @profile = opts["profile"] || {}
8
+ @access_token = opts["access_token"]
8
9
  end
9
10
 
10
11
  def display_name
@@ -1,3 +1,3 @@
1
1
  module GoogleAssistant
2
- VERSION = "0.2.0"
2
+ VERSION = "1.0.0.beta"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_assistant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Milam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-21 00:00:00.000000000 Z
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,9 +94,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - ">="
97
+ - - ">"
98
98
  - !ruby/object:Gem::Version
99
- version: '0'
99
+ version: 1.3.1
100
100
  requirements: []
101
101
  rubyforge_project:
102
102
  rubygems_version: 2.5.1