ketra 0.3.0 → 0.4.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: 270326b96585a4978596304cafc2e0321b78af5a
4
- data.tar.gz: 282ccceb5dc19ae5e41f1f5a7dd74c4c49e36ebd
3
+ metadata.gz: 2a3d3b4f31d76efdb3a5658e959c3d6e3cdb524e
4
+ data.tar.gz: 66904f2e267f408336aa657637dfa382bc17598e
5
5
  SHA512:
6
- metadata.gz: fb0dfc716a86a1157503d2f71523039e4f42b0e478412070e62d5f6020377c5ac4192210a953973e02dda42e9a006fbb6f9b5820ee54f69c61555670e94e9f01
7
- data.tar.gz: c9b0cdb0a791b89e1587a6971ef8e087080893be5f36d50405f09d166a997c617a689a7e112ba788600977886af335f3a418c39a4f58e97ce7fd60960e99b458
6
+ metadata.gz: 107c0bc057a83be0dfbace70bf5265d9db3a3957e9e4133c5e9df9700c0024cbbfb19c84358a12f77831358fc1e1b9b5d6c3831bd862a15f4e84a27064b0e67b
7
+ data.tar.gz: a52a6e1001e31fe99d3cb719f2c623835e2feeddbcab1c2b6d908d2827910b4f33b7edefbe51a7189f880ec96bc52f3dc2ee37a89a328706b2b65fb8eb212c96
data/README.md CHANGED
@@ -14,7 +14,7 @@ Add this line to your application's Gemfile:
14
14
  gem 'ketra'
15
15
  ```
16
16
 
17
- NOTE: versions >= 0.3.0 is only supported for use with Ketra N4 Hubs with 1.15+ firmware
17
+ NOTE: versions 0.3.0+ are only supported for use with Ketra N4 Hubs with 1.15+ firmware
18
18
 
19
19
  And then execute:
20
20
 
@@ -36,29 +36,39 @@ In order to use this gem you will need to contact Ketra Support and get assigned
36
36
  require 'ketra'
37
37
  Ketra.client_id = 'YOUR CLIENT ID'
38
38
  Ketra.client_secret = 'YOUR CLIENT SECRET'
39
- Ketra.authorization_grant = :password
40
- credentials = { username: 'YOUR DESIGN STUDIO USERNAME', password: 'YOUR DESIGN STUDIO PASSWORD' }
41
- Ketra.authorize(credentials)
42
- access_token = Ketra.access_token
39
+ Ketra.client.authorize(:username => 'YOUR DESIGN STUDIO USERNAME', :password => 'YOUR DESIGN STUDIO PASSWORD)
40
+ access_token = Ketra.client.access_token
43
41
  ```
44
42
 
45
43
  #### Set Access Token Directly
46
44
 
47
45
  ```ruby
48
- Ketra.access_token = 'YOUR ACCESS TOKEN'
46
+ Ketra.client.options[:authorization_mode] = :token
47
+ Ketra.client.authorize(:token => 'YOUR ACCESS TOKEN')
49
48
  ```
50
49
 
51
50
  ### Commands
52
51
 
53
52
  All commands require authentication.
54
53
 
55
- #### Activate Button
54
+ #### Keypad Buttons
56
55
 
57
56
  ```ruby
58
- Ketra.hub_serial = 'YOUR HUB SERIAL NUMBER'
57
+ Ketra.client.options[:hub_serial] = 'YOUR HUB SERIAL NUMBER'
59
58
  Ketra::Commands.activate_button('YOUR KEYPAD NAME', 'YOUR BUTTON NAME')
59
+ Ketra::Commands.deactivate_button('YOUR KEYPAD NAME', 'YOUR BUTTON NAME')
60
+ Ketra::Commands.push_button('YOUR KEYPAD NAME', 'YOUR BUTTON NAME')
60
61
  ```
61
62
 
63
+ #### Queries
64
+
65
+ ```ruby
66
+ Ketra.client.options[:hub_serial] = 'YOUR HUB SERIAL NUMBER'
67
+ Ketra::Commands.keypads
68
+ Ketra::Commands.groups
69
+ ```
70
+
71
+
62
72
  ## Development
63
73
 
64
74
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -29,8 +29,10 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_runtime_dependency 'oauth2', '~> 1.3', '>= 1.3.1'
31
31
  spec.add_dependency 'json', '~> 2.1', '~> 2.1.0'
32
+ spec.add_dependency 'addressable', '~> 2.5'
32
33
 
33
34
  spec.add_development_dependency 'bundler', '~> 1.10'
34
35
  spec.add_development_dependency 'rake', '~> 10.0'
35
36
  spec.add_development_dependency 'rspec', '~> 3.5'
37
+ spec.add_development_dependency 'byebug'
36
38
  end
@@ -1,4 +1,5 @@
1
1
  require 'oauth2'
2
+ require 'addressable/uri'
2
3
 
3
4
  require "ketra/version"
4
5
  require "ketra/client"
@@ -1,6 +1,3 @@
1
- require 'addressable'
2
- require 'byebug'
3
-
4
1
  module Ketra
5
2
  class Client
6
3
  PRODUCTION_HOST = 'https://my.goketra.com'
@@ -37,6 +34,7 @@ module Ketra
37
34
  @access_token = auth_client.auth_code.get_token(credentials[:authorization_code],
38
35
  :redirect_uri => options[:redirect_uri])
39
36
  else :password
37
+ byebug
40
38
  @access_token = auth_client.password.get_token(credentials[:username],
41
39
  credentials[:password])
42
40
  end
@@ -1,3 +1,3 @@
1
1
  module Ketra
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ketra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth Priester
@@ -50,6 +50,20 @@ dependencies:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
52
  version: 2.1.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: addressable
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '2.5'
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.5'
53
67
  - !ruby/object:Gem::Dependency
54
68
  name: bundler
55
69
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +106,20 @@ dependencies:
92
106
  - - "~>"
93
107
  - !ruby/object:Gem::Version
94
108
  version: '3.5'
109
+ - !ruby/object:Gem::Dependency
110
+ name: byebug
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
95
123
  description: A friendly Ruby interface to the Ketra API
96
124
  email:
97
125
  - kennethjpriester@gmail.com