seamapi 0.0.5 → 1.0.0.pre.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -4
- data/Gemfile.lock +60 -25
- data/LICENSE.txt +20 -0
- data/README.md +162 -21
- data/Rakefile +13 -3
- data/lib/seam/client.rb +4 -2
- data/lib/seam/request.rb +1 -1
- data/lib/seam/resources/connect_webview.rb +3 -3
- data/lib/seam/version.rb +1 -1
- metadata +131 -31
- data/.rspec +0 -3
- data/.rubocop.yml +0 -32
- data/lib/seam/clients/access_codes.rb +0 -72
- data/lib/seam/clients/action_attempts.rb +0 -17
- data/lib/seam/clients/connect_webviews.rb +0 -37
- data/lib/seam/clients/connected_accounts.rb +0 -33
- data/lib/seam/clients/devices.rb +0 -27
- data/lib/seam/clients/locks.rb +0 -67
- data/lib/seam/clients/workspaces.rb +0 -35
- data/lib/seam/resources/access_code.rb +0 -9
- data/lib/seam/resources/base_resource.rb +0 -58
- data/lib/seam/resources/device.rb +0 -9
- data/lib/seam/resources/workspace.rb +0 -7
- data/seamapi.gemspec +0 -30
- data/sig/seamapi.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5db2b08710dbe182257c9f8be959e0b3435b14cdfbc0eeaee97d0a4d32cc3050
|
4
|
+
data.tar.gz: b74ecbd629d61e2d3b03c87277425cad2e91db08426187d6965045b024b7bfb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '05805351dae5222e1ec01314478dd73fcdb78fe71e0802236bf303908f4f9926ecafb6556cc93d1a90d5cf56efdae53467cdab2b1e30843928fab430e9cbf24a'
|
7
|
+
data.tar.gz: 1f5dac528073ba5574ca08f8093ed1485e7eabf769e093f91e5dc2490c79305337da525e8afba1a978e955723fc24b3865240c128aa2372a62fff5af8ea83a85
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,24 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
seamapi (0.0.
|
4
|
+
seamapi (1.0.0.pre.rc.0)
|
5
5
|
http (~> 5.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.8.
|
11
|
-
public_suffix (>= 2.0.2, <
|
10
|
+
addressable (2.8.1)
|
11
|
+
public_suffix (>= 2.0.2, < 6.0)
|
12
|
+
ansi (1.5.0)
|
12
13
|
ast (2.4.2)
|
13
14
|
crack (0.4.5)
|
14
15
|
rexml
|
15
16
|
diff-lcs (1.5.0)
|
17
|
+
docile (1.4.0)
|
16
18
|
domain_name (0.5.20190701)
|
17
19
|
unf (>= 0.0.5, < 1.0.0)
|
18
20
|
ffi (1.15.5)
|
19
21
|
ffi-compiler (1.0.1)
|
20
22
|
ffi (>= 1.0.0)
|
21
23
|
rake
|
24
|
+
gem-release (2.2.2)
|
22
25
|
hashdiff (1.0.1)
|
23
26
|
http (5.0.4)
|
24
27
|
addressable (~> 2.8)
|
@@ -28,60 +31,92 @@ GEM
|
|
28
31
|
http-cookie (1.0.5)
|
29
32
|
domain_name (~> 0.5)
|
30
33
|
http-form_data (2.3.0)
|
34
|
+
json (2.6.2)
|
31
35
|
llhttp-ffi (0.4.0)
|
32
36
|
ffi-compiler (~> 1.0)
|
33
37
|
rake (~> 13.0)
|
38
|
+
multi_json (1.15.0)
|
34
39
|
parallel (1.22.1)
|
35
|
-
|
40
|
+
parse_gemspec (1.0.0)
|
41
|
+
parse_gemspec-cli (1.0.0)
|
42
|
+
multi_json
|
43
|
+
parse_gemspec
|
44
|
+
thor
|
45
|
+
parser (3.1.2.1)
|
36
46
|
ast (~> 2.4.1)
|
37
|
-
public_suffix (
|
47
|
+
public_suffix (5.0.0)
|
38
48
|
rainbow (3.1.1)
|
39
49
|
rake (13.0.6)
|
40
|
-
regexp_parser (2.
|
50
|
+
regexp_parser (2.6.1)
|
41
51
|
rexml (3.2.5)
|
42
|
-
rspec (3.
|
43
|
-
rspec-core (~> 3.
|
44
|
-
rspec-expectations (~> 3.
|
45
|
-
rspec-mocks (~> 3.
|
46
|
-
rspec-core (3.
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-expectations (3.
|
52
|
+
rspec (3.12.0)
|
53
|
+
rspec-core (~> 3.12.0)
|
54
|
+
rspec-expectations (~> 3.12.0)
|
55
|
+
rspec-mocks (~> 3.12.0)
|
56
|
+
rspec-core (3.12.0)
|
57
|
+
rspec-support (~> 3.12.0)
|
58
|
+
rspec-expectations (3.12.0)
|
49
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-mocks (3.
|
60
|
+
rspec-support (~> 3.12.0)
|
61
|
+
rspec-mocks (3.12.0)
|
52
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-support (3.
|
55
|
-
rubocop (1.
|
63
|
+
rspec-support (~> 3.12.0)
|
64
|
+
rspec-support (3.12.0)
|
65
|
+
rubocop (1.39.0)
|
66
|
+
json (~> 2.3)
|
56
67
|
parallel (~> 1.10)
|
57
|
-
parser (>= 3.1.
|
68
|
+
parser (>= 3.1.2.1)
|
58
69
|
rainbow (>= 2.2.2, < 4.0)
|
59
70
|
regexp_parser (>= 1.8, < 3.0)
|
60
71
|
rexml (>= 3.2.5, < 4.0)
|
61
|
-
rubocop-ast (>= 1.
|
72
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
62
73
|
ruby-progressbar (~> 1.7)
|
63
74
|
unicode-display_width (>= 1.4.0, < 3.0)
|
64
|
-
rubocop-ast (1.
|
75
|
+
rubocop-ast (1.23.0)
|
65
76
|
parser (>= 3.1.1.0)
|
77
|
+
rubocop-performance (1.15.1)
|
78
|
+
rubocop (>= 1.7.0, < 2.0)
|
79
|
+
rubocop-ast (>= 0.4.0)
|
66
80
|
ruby-progressbar (1.11.0)
|
81
|
+
simplecov (0.21.2)
|
82
|
+
docile (~> 1.1)
|
83
|
+
simplecov-html (~> 0.11)
|
84
|
+
simplecov_json_formatter (~> 0.1)
|
85
|
+
simplecov-console (0.9.1)
|
86
|
+
ansi
|
87
|
+
simplecov
|
88
|
+
terminal-table
|
89
|
+
simplecov-html (0.12.3)
|
90
|
+
simplecov_json_formatter (0.1.4)
|
91
|
+
standard (1.18.1)
|
92
|
+
rubocop (= 1.39.0)
|
93
|
+
rubocop-performance (= 1.15.1)
|
94
|
+
terminal-table (3.0.2)
|
95
|
+
unicode-display_width (>= 1.1.1, < 3)
|
96
|
+
thor (1.2.1)
|
67
97
|
unf (0.1.4)
|
68
98
|
unf_ext
|
69
99
|
unf_ext (0.0.8.2)
|
70
|
-
unicode-display_width (2.
|
100
|
+
unicode-display_width (2.3.0)
|
71
101
|
webmock (3.0.1)
|
72
102
|
addressable (>= 2.3.6)
|
73
103
|
crack (>= 0.3.2)
|
74
104
|
hashdiff
|
75
105
|
|
76
106
|
PLATFORMS
|
77
|
-
|
107
|
+
x86_64-linux
|
78
108
|
|
79
109
|
DEPENDENCIES
|
110
|
+
bundler (~> 2.0)
|
111
|
+
gem-release (~> 2.2)
|
112
|
+
parse_gemspec-cli (~> 1.0)
|
80
113
|
rake (~> 13.0)
|
81
114
|
rspec (~> 3.0)
|
82
|
-
rubocop (~> 1.21)
|
83
115
|
seamapi!
|
116
|
+
simplecov (~> 0.21)
|
117
|
+
simplecov-console (~> 0.9)
|
118
|
+
standard (~> 1.3)
|
84
119
|
webmock (~> 3.0.0)
|
85
120
|
|
86
121
|
BUNDLED WITH
|
87
|
-
2.3.
|
122
|
+
2.3.26
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Seam Labs, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,41 +1,182 @@
|
|
1
|
-
# Seam API Ruby
|
1
|
+
# Seam API Ruby SDK
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
[![RubyGems.org](https://img.shields.io/gem/v/seamapi)](https://rubygems.org/gems/seamapi)
|
4
|
+
[![GitHub Actions](https://github.com/seamapi/ruby/workflows/main/badge.svg)](https://github.com/seamapi/ruby/actions)
|
5
|
+
[![Docs](https://img.shields.io/badge/docs-latest-blue)](https://docs.seam.co/)
|
6
6
|
|
7
|
-
|
7
|
+
Official interface to the [Seam Connect API].
|
8
8
|
|
9
|
-
|
10
|
-
- Simplified asynchronous flows, including listening for events or actions to finish
|
9
|
+
[Seam Connect API]: https://docs.seam.co/
|
11
10
|
|
12
|
-
##
|
11
|
+
## Description
|
12
|
+
|
13
|
+
This SDK provides convenient access to the [Seam Connect API] for Ruby applications.
|
13
14
|
|
14
|
-
|
15
|
+
This library includes:
|
15
16
|
|
16
|
-
|
17
|
+
- A predefined set of classes for API resources that
|
18
|
+
initialize themselves dynamically from API responses.
|
19
|
+
- Methods for all [Seam API endpoints].
|
20
|
+
- Simplified asynchronous flows, e.g., listening for events or actions to finish.
|
17
21
|
|
18
|
-
|
22
|
+
[Seam API endpoints]: https://docs.seam.co/latest/api-endpoints/overview
|
19
23
|
|
20
|
-
|
24
|
+
## Installation
|
25
|
+
|
26
|
+
Add this as a dependency to your project using [Bundler] with
|
27
|
+
|
28
|
+
```
|
29
|
+
$ bundle add seamapi
|
30
|
+
```
|
31
|
+
|
32
|
+
[bundler]: https://bundler.io/
|
21
33
|
|
22
34
|
## Usage
|
23
35
|
|
24
|
-
|
36
|
+
_Refer to the [Seam Connect API documentation][Seam Connect API]._
|
25
37
|
|
26
|
-
|
27
|
-
seam = Seam::Client.new(api_key: "MY_API_KEY")
|
38
|
+
### Requirements
|
28
39
|
|
29
|
-
|
40
|
+
- Ruby version 3 or later.
|
41
|
+
- An API Key generated via the [Seam Dashboard].
|
30
42
|
|
31
|
-
|
43
|
+
[Seam Dashboard]: https://dashboard.getseam.com
|
44
|
+
|
45
|
+
### Example
|
32
46
|
|
47
|
+
```ruby
|
48
|
+
seam = Seam::Client.new(api_key: "MY_SEAM_API_KEY")
|
49
|
+
devices = seam.devices.list
|
50
|
+
my_door = devices.first
|
33
51
|
seam.locks.unlock(my_door).wait_until_finished
|
52
|
+
```
|
53
|
+
|
54
|
+
## Development and Testing
|
55
|
+
|
56
|
+
### Quickstart
|
57
|
+
|
58
|
+
```
|
59
|
+
$ git clone https://github.com/seamapi/ruby.git
|
60
|
+
$ cd ruby
|
61
|
+
$ bundle install
|
62
|
+
```
|
63
|
+
|
64
|
+
Run the command below
|
65
|
+
|
66
|
+
```
|
67
|
+
$ bundle exec rake
|
68
|
+
```
|
69
|
+
|
70
|
+
Open an interactive ruby console with
|
71
|
+
|
72
|
+
```
|
73
|
+
$ bundle exec rake
|
74
|
+
```
|
75
|
+
|
76
|
+
Primary development tasks are defined as [rake] tasks in the `Rakefile`
|
77
|
+
and available via `rake`.
|
78
|
+
View them with
|
79
|
+
|
80
|
+
```
|
81
|
+
$ bundle exec rake -T
|
82
|
+
```
|
83
|
+
|
84
|
+
[rake]: https://ruby.github.io/rake/
|
85
|
+
|
86
|
+
### Interactive Console
|
87
|
+
|
88
|
+
Play around with this module inside an interactive console with
|
89
|
+
|
90
|
+
```
|
91
|
+
$ rake console
|
92
|
+
```
|
93
|
+
|
94
|
+
Use a sandbox API key to play with the SDK without touching real devices.
|
95
|
+
|
96
|
+
### Source code
|
97
|
+
|
98
|
+
The [source code] is hosted on GitHub.
|
99
|
+
Clone the project with
|
100
|
+
|
101
|
+
```
|
102
|
+
$ git clone git@github.com:seamapi/ruby.git
|
103
|
+
```
|
104
|
+
|
105
|
+
[source code]: https://github.com/seamapi/ruby
|
106
|
+
|
107
|
+
### Requirements
|
108
|
+
|
109
|
+
You will need [Ruby] with [Bundler].
|
110
|
+
|
111
|
+
Be sure that all commands run under the correct Ruby version, e.g.,
|
112
|
+
if using [rbenv], install the correct version with
|
113
|
+
|
114
|
+
```
|
115
|
+
$ rbenv install
|
116
|
+
```
|
117
|
+
|
118
|
+
Install the development dependencies with
|
34
119
|
|
35
120
|
```
|
121
|
+
$ bundle install
|
122
|
+
```
|
123
|
+
|
124
|
+
[bundler]: https://bundler.io/
|
125
|
+
[ruby]: https://www.ruby-lang.org/
|
126
|
+
[rbenv]: https://github.com/rbenv/rbenv
|
127
|
+
|
128
|
+
### Publishing
|
129
|
+
|
130
|
+
Releases are handled automatically by [semantic-release].
|
131
|
+
Publishing may be triggered manually using a [workflow_dispatch on GitHub Actions].
|
132
|
+
|
133
|
+
[semantic-release]: https://semantic-release.gitbook.io/
|
134
|
+
[workflow_dispatch on github actions]: https://github.com/seamapi/ruby/actions?query=workflow%3Aversion
|
135
|
+
|
136
|
+
## GitHub Actions
|
137
|
+
|
138
|
+
_GitHub Actions should already be configured: this section is for reference only._
|
139
|
+
|
140
|
+
The following repository secrets must be set on [GitHub Actions]:
|
141
|
+
|
142
|
+
- `RUBYGEMS_API_KEY`: RubyGems.org token for publishing packages.
|
143
|
+
- `GH_TOKEN`: A personal access token for the user.
|
144
|
+
- `GIT_USER_NAME`: The GitHub user's real name.
|
145
|
+
- `GIT_USER_EMAIL`: The GitHub user's email.
|
146
|
+
- `GPG_PRIVATE_KEY`: The GitHub user's [GPG private key].
|
147
|
+
- `GPG_PASSPHRASE`: The GitHub user's GPG passphrase.
|
148
|
+
|
149
|
+
These are set at the organization level.
|
150
|
+
|
151
|
+
[github actions]: https://github.com/features/actions
|
152
|
+
[gpg private key]: https://github.com/marketplace/actions/import-gpg#prerequisites
|
153
|
+
|
154
|
+
## Contributing
|
155
|
+
|
156
|
+
Please submit and comment on bug reports and feature requests.
|
157
|
+
|
158
|
+
To submit a patch:
|
159
|
+
|
160
|
+
1. Fork it (https://github.com/seamapi/ruby/fork).
|
161
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
162
|
+
3. Make changes.
|
163
|
+
4. Commit your changes (`git commit -am 'Add some feature'`).
|
164
|
+
5. Push to the branch (`git push origin my-new-feature`).
|
165
|
+
6. Create a new Pull Request.
|
166
|
+
|
167
|
+
## License
|
168
|
+
|
169
|
+
This Ruby gem is licensed under the MIT license.
|
36
170
|
|
37
|
-
##
|
171
|
+
## Warranty
|
38
172
|
|
39
|
-
|
40
|
-
|
41
|
-
|
173
|
+
This software is provided by the copyright holders and contributors "as is" and
|
174
|
+
any express or implied warranties, including, but not limited to, the implied
|
175
|
+
warranties of merchantability and fitness for a particular purpose are
|
176
|
+
disclaimed. In no event shall the copyright holder or contributors be liable for
|
177
|
+
any direct, indirect, incidental, special, exemplary, or consequential damages
|
178
|
+
(including, but not limited to, procurement of substitute goods or services;
|
179
|
+
loss of use, data, or profits; or business interruption) however caused and on
|
180
|
+
any theory of liability, whether in contract, strict liability, or tort
|
181
|
+
(including negligence or otherwise) arising in any way out of the use of this
|
182
|
+
software, even if advised of the possibility of such damage.
|
data/Rakefile
CHANGED
@@ -2,11 +2,21 @@
|
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
require "rspec/core/rake_task"
|
5
|
+
require "standard/rake"
|
5
6
|
|
6
7
|
RSpec::Core::RakeTask.new(:spec)
|
7
8
|
|
8
|
-
|
9
|
+
task default: %i[lint test]
|
9
10
|
|
10
|
-
|
11
|
+
task test: "spec"
|
12
|
+
task lint: "standard"
|
13
|
+
task format: "standard:fix"
|
11
14
|
|
12
|
-
|
15
|
+
desc "Open an interactive ruby console"
|
16
|
+
task :console do
|
17
|
+
require "irb"
|
18
|
+
require "bundler/setup"
|
19
|
+
require "seamapi"
|
20
|
+
ARGV.clear
|
21
|
+
IRB.start
|
22
|
+
end
|
data/lib/seam/client.rb
CHANGED
@@ -4,10 +4,12 @@ module Seam
|
|
4
4
|
class Client
|
5
5
|
attr_accessor :api_key, :base_uri, :debug
|
6
6
|
|
7
|
-
def initialize(api_key
|
8
|
-
@api_key = api_key
|
7
|
+
def initialize(api_key: nil, base_uri: "https://connect.getseam.com", debug: false)
|
8
|
+
@api_key = api_key || ENV.fetch("SEAM_API_KEY", nil)
|
9
9
|
@base_uri = base_uri
|
10
10
|
@debug = debug
|
11
|
+
|
12
|
+
raise ArgumentError, "SEAM_API_KEY not found in environment, and api_key not provided" unless @api_key
|
11
13
|
end
|
12
14
|
|
13
15
|
def health
|
data/lib/seam/request.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module Seam
|
4
4
|
class ConnectWebview < BaseResource
|
5
|
-
attr_accessor :connect_webview_id, :custom_redirect_url, :
|
6
|
-
|
7
|
-
|
5
|
+
attr_accessor :connect_webview_id, :custom_redirect_url, :custom_redirect_failure_url, :url,
|
6
|
+
:workspace_id, :device_selection_mode, :accepted_providers, :accepted_devices,
|
7
|
+
:any_provider_allowed, :any_device_allowed, :login_successful, :status
|
8
8
|
|
9
9
|
date_accessor :created_at
|
10
10
|
end
|
data/lib/seam/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seamapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 1.0.0.pre.rc.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
7
|
+
- Seam Labs, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -24,6 +24,118 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 5.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gem-release
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: parse_gemspec-cli
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '13.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '13.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.21'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.21'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov-console
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.9'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.9'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: standard
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.3'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.3'
|
27
139
|
- !ruby/object:Gem::Dependency
|
28
140
|
name: webmock
|
29
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,48 +150,36 @@ dependencies:
|
|
38
150
|
- - "~>"
|
39
151
|
- !ruby/object:Gem::Version
|
40
152
|
version: 3.0.0
|
41
|
-
description:
|
42
|
-
|
43
|
-
email:
|
44
|
-
- abi@getseam.com
|
153
|
+
description: Official interface to the Seam Connect API.
|
154
|
+
email: devops@getseam.com
|
45
155
|
executables: []
|
46
156
|
extensions: []
|
47
157
|
extra_rdoc_files: []
|
48
158
|
files:
|
49
|
-
- ".rspec"
|
50
|
-
- ".rubocop.yml"
|
51
159
|
- Gemfile
|
52
160
|
- Gemfile.lock
|
161
|
+
- LICENSE.txt
|
53
162
|
- README.md
|
54
163
|
- Rakefile
|
55
164
|
- lib/seam/client.rb
|
56
|
-
- lib/seam/clients/access_codes.rb
|
57
|
-
- lib/seam/clients/action_attempts.rb
|
58
165
|
- lib/seam/clients/base_client.rb
|
59
|
-
- lib/seam/clients/connect_webviews.rb
|
60
|
-
- lib/seam/clients/connected_accounts.rb
|
61
|
-
- lib/seam/clients/devices.rb
|
62
|
-
- lib/seam/clients/locks.rb
|
63
|
-
- lib/seam/clients/workspaces.rb
|
64
166
|
- lib/seam/logger.rb
|
65
167
|
- lib/seam/request.rb
|
66
|
-
- lib/seam/resources/access_code.rb
|
67
168
|
- lib/seam/resources/action_attempt.rb
|
68
|
-
- lib/seam/resources/base_resource.rb
|
69
169
|
- lib/seam/resources/connect_webview.rb
|
70
170
|
- lib/seam/resources/connected_account.rb
|
71
|
-
- lib/seam/resources/device.rb
|
72
|
-
- lib/seam/resources/workspace.rb
|
73
171
|
- lib/seam/version.rb
|
74
172
|
- lib/seamapi.rb
|
75
|
-
- seamapi.gemspec
|
76
|
-
- sig/seamapi.rbs
|
77
173
|
homepage: https://github.com/seamapi/ruby
|
78
|
-
licenses:
|
174
|
+
licenses:
|
175
|
+
- MIT
|
79
176
|
metadata:
|
80
177
|
homepage_uri: https://github.com/seamapi/ruby
|
81
178
|
source_code_uri: https://github.com/seamapi/ruby
|
82
|
-
|
179
|
+
bug_tracker_uri: https://github.com/seamapi/ruby/issues
|
180
|
+
changelog_uri: https://github.com/seamapi/ruby/releases
|
181
|
+
github_repo: git@github.com:seamapi/ruby.git
|
182
|
+
post_install_message:
|
83
183
|
rdoc_options: []
|
84
184
|
require_paths:
|
85
185
|
- lib
|
@@ -90,12 +190,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
190
|
version: 2.6.0
|
91
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
192
|
requirements:
|
93
|
-
- - "
|
193
|
+
- - ">"
|
94
194
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
195
|
+
version: 1.3.1
|
96
196
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
98
|
-
signing_key:
|
197
|
+
rubygems_version: 3.2.33
|
198
|
+
signing_key:
|
99
199
|
specification_version: 4
|
100
|
-
summary: Seam API Ruby
|
200
|
+
summary: Seam API Ruby SDK
|
101
201
|
test_files: []
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.6
|
3
|
-
NewCops: enable
|
4
|
-
|
5
|
-
Style/StringLiterals:
|
6
|
-
Enabled: true
|
7
|
-
EnforcedStyle: double_quotes
|
8
|
-
|
9
|
-
Style/StringLiteralsInInterpolation:
|
10
|
-
Enabled: true
|
11
|
-
EnforcedStyle: double_quotes
|
12
|
-
|
13
|
-
Layout/LineLength:
|
14
|
-
Max: 120
|
15
|
-
|
16
|
-
Style/Documentation:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Metrics/BlockLength:
|
20
|
-
IgnoredMethods: ['describe', 'context', 'xdescribe']
|
21
|
-
|
22
|
-
Gemspec/RequireMFA:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Metrics/AbcSize:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
Style/BlockDelimiters:
|
29
|
-
Enabled: false
|
30
|
-
|
31
|
-
Metrics/MethodLength:
|
32
|
-
Enabled: false
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Seam
|
4
|
-
module Clients
|
5
|
-
class AccessCodes < BaseClient
|
6
|
-
def get(access_code_id)
|
7
|
-
request_seam_object(
|
8
|
-
:get,
|
9
|
-
"/access_codes/get",
|
10
|
-
Seam::AccessCode,
|
11
|
-
"access_code",
|
12
|
-
params: { access_code_id: access_code_id }
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def list(device_or_id)
|
17
|
-
device_id = device_or_id.is_a?(Seam::Device) ? device_or_id.device_id : device_or_id
|
18
|
-
|
19
|
-
request_seam_object(
|
20
|
-
:get,
|
21
|
-
"/access_codes/list",
|
22
|
-
Seam::AccessCode,
|
23
|
-
"access_codes",
|
24
|
-
params: { device_id: device_id }
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def create(device_id: nil, name: nil, code: nil, starts_at: nil, ends_at: nil)
|
29
|
-
action_attempt = request_seam_object(
|
30
|
-
:post,
|
31
|
-
"/access_codes/create",
|
32
|
-
Seam::ActionAttempt,
|
33
|
-
"action_attempt",
|
34
|
-
body: { device_id: device_id, code: code, starts_at: starts_at, ends_at: ends_at, name: name }.compact
|
35
|
-
)
|
36
|
-
action_attempt.wait_until_finished
|
37
|
-
# TODO: check if failed
|
38
|
-
Seam::AccessCode.new(action_attempt.result["access_code"], @client)
|
39
|
-
end
|
40
|
-
|
41
|
-
def delete(access_code_id)
|
42
|
-
action_attempt = request_seam_object(
|
43
|
-
:post,
|
44
|
-
"/access_codes/delete",
|
45
|
-
Seam::ActionAttempt,
|
46
|
-
"action_attempt",
|
47
|
-
body: { access_code_id: access_code_id }
|
48
|
-
)
|
49
|
-
action_attempt.wait_until_finished
|
50
|
-
action_attempt
|
51
|
-
end
|
52
|
-
|
53
|
-
def update(access_code_id: nil, name: nil, code: nil, starts_at: nil, ends_at: nil)
|
54
|
-
action_attempt = request_seam_object(
|
55
|
-
:post,
|
56
|
-
"/access_codes/update",
|
57
|
-
Seam::ActionAttempt,
|
58
|
-
"action_attempt",
|
59
|
-
body: {
|
60
|
-
access_code_id: access_code_id,
|
61
|
-
name: name,
|
62
|
-
code: code,
|
63
|
-
starts_at: starts_at,
|
64
|
-
ends_at: ends_at
|
65
|
-
}.compact
|
66
|
-
)
|
67
|
-
action_attempt.wait_until_finished
|
68
|
-
action_attempt
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Seam
|
4
|
-
module Clients
|
5
|
-
class ActionAttempts < BaseClient
|
6
|
-
def get(action_attempt_id)
|
7
|
-
request_seam_object(
|
8
|
-
:get,
|
9
|
-
"/action_attempts/get",
|
10
|
-
Seam::ActionAttempt,
|
11
|
-
"action_attempt",
|
12
|
-
params: { action_attempt_id: action_attempt_id }
|
13
|
-
)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Seam
|
4
|
-
module Clients
|
5
|
-
class ConnectWebviews < BaseClient
|
6
|
-
def get(connect_webview_id = nil)
|
7
|
-
request_seam_object(
|
8
|
-
:get,
|
9
|
-
"/connect_webviews/get",
|
10
|
-
Seam::ConnectWebview,
|
11
|
-
"connect_webview",
|
12
|
-
params: { connect_webview_id: connect_webview_id }
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def list
|
17
|
-
request_seam_object(
|
18
|
-
:get,
|
19
|
-
"/connect_webviews/list",
|
20
|
-
Seam::ConnectWebview,
|
21
|
-
"connect_webviews",
|
22
|
-
params: {}
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
def create(accepted_providers: nil)
|
27
|
-
request_seam_object(
|
28
|
-
:post,
|
29
|
-
"/connect_webviews/create",
|
30
|
-
Seam::ConnectWebview,
|
31
|
-
"connect_webview",
|
32
|
-
body: { accepted_providers: accepted_providers }
|
33
|
-
)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Seam
|
4
|
-
module Clients
|
5
|
-
class ConnectedAccounts < BaseClient
|
6
|
-
def get(connected_account_id_or_params)
|
7
|
-
params = if connected_account_id_or_params.is_a?(String)
|
8
|
-
{ connected_account_id: connected_account_id_or_params }
|
9
|
-
else
|
10
|
-
connected_account_id_or_params
|
11
|
-
end
|
12
|
-
|
13
|
-
request_seam_object(
|
14
|
-
:get,
|
15
|
-
"/connected_accounts/get",
|
16
|
-
Seam::ConnectedAccount,
|
17
|
-
"connected_account",
|
18
|
-
params: params
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
def list(params = {})
|
23
|
-
request_seam_object(
|
24
|
-
:get,
|
25
|
-
"/connected_accounts/list",
|
26
|
-
Seam::ConnectedAccount,
|
27
|
-
"connected_accounts",
|
28
|
-
params: params
|
29
|
-
)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/lib/seam/clients/devices.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Seam
|
4
|
-
module Clients
|
5
|
-
class Devices < BaseClient
|
6
|
-
def list(params = {})
|
7
|
-
request_seam_object(
|
8
|
-
:get,
|
9
|
-
"/devices/list",
|
10
|
-
Seam::Device,
|
11
|
-
"devices",
|
12
|
-
params: params
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def get(device_id)
|
17
|
-
request_seam_object(
|
18
|
-
:get,
|
19
|
-
"/devices/get",
|
20
|
-
Seam::Device,
|
21
|
-
"device",
|
22
|
-
params: { device_id: device_id }
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/seam/clients/locks.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Seam
|
4
|
-
module Clients
|
5
|
-
class Locks < BaseClient
|
6
|
-
# Unlocks a door
|
7
|
-
#
|
8
|
-
# @param [String] device_id
|
9
|
-
# @return [Seam::ActionAttempt]
|
10
|
-
def unlock_door(device_or_id)
|
11
|
-
request_seam_object(
|
12
|
-
:post,
|
13
|
-
"/locks/unlock_door",
|
14
|
-
Seam::ActionAttempt,
|
15
|
-
"action_attempt",
|
16
|
-
body: {
|
17
|
-
device_id: device_id(device_or_id)
|
18
|
-
}
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Locks a door
|
23
|
-
#
|
24
|
-
# @param [String] device_id
|
25
|
-
# @return [Seam::ActionAttempt]
|
26
|
-
def lock_door(device_or_id)
|
27
|
-
request_seam_object(
|
28
|
-
:post,
|
29
|
-
"/locks/lock_door",
|
30
|
-
Seam::ActionAttempt,
|
31
|
-
"action_attempt",
|
32
|
-
body: {
|
33
|
-
device_id: device_id(device_or_id)
|
34
|
-
}
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
def list(params = {})
|
39
|
-
request_seam_object(
|
40
|
-
:get,
|
41
|
-
"/locks/list",
|
42
|
-
Seam::Device,
|
43
|
-
"locks",
|
44
|
-
params: params
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
def get(device_or_id)
|
49
|
-
request_seam_object(
|
50
|
-
:get,
|
51
|
-
"/locks/get",
|
52
|
-
Seam::Device,
|
53
|
-
"lock",
|
54
|
-
params: {
|
55
|
-
device_id: device_id(device_or_id)
|
56
|
-
}
|
57
|
-
)
|
58
|
-
end
|
59
|
-
|
60
|
-
protected
|
61
|
-
|
62
|
-
def device_id(device_or_id)
|
63
|
-
device_or_id.is_a?(Seam::Device) ? device_or_id.device_id : device_or_id
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Seam
|
4
|
-
module Clients
|
5
|
-
class Workspaces < BaseClient
|
6
|
-
def get(workspace_id = nil)
|
7
|
-
request_seam_object(
|
8
|
-
:get,
|
9
|
-
"/workspaces/get",
|
10
|
-
Seam::Workspace,
|
11
|
-
"workspace",
|
12
|
-
params: { workspace_id: workspace_id }
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def list
|
17
|
-
request_seam_object(
|
18
|
-
:get,
|
19
|
-
"/workspaces/list",
|
20
|
-
Seam::Workspace,
|
21
|
-
"workspaces",
|
22
|
-
params: {}
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
def reset_sandbox(workspace_id)
|
27
|
-
request_seam(
|
28
|
-
:post,
|
29
|
-
"/workspaces/reset_sandbox",
|
30
|
-
params: { workspace_id: workspace_id }
|
31
|
-
)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Seam
|
4
|
-
class BaseResource
|
5
|
-
attr_accessor :data, :client
|
6
|
-
|
7
|
-
def initialize(data, client = nil)
|
8
|
-
@data = data
|
9
|
-
@client = client
|
10
|
-
|
11
|
-
@data.each do |key, value|
|
12
|
-
instance_variable_set("@#{key}", value)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def update_from_response(data)
|
17
|
-
@data = data
|
18
|
-
@data.each do |key, value|
|
19
|
-
instance_variable_set("@#{key}", value)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.load_from_response(data, client = nil)
|
24
|
-
if data.is_a?(Array)
|
25
|
-
data.map { |d| new(d, client) }
|
26
|
-
else
|
27
|
-
new(data, client)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def inspect
|
32
|
-
"<#{self.class.name}:#{"0x00%x" % (object_id << 1)}\n" + # rubocop:disable Style/StringConcatenation, Style/FormatString
|
33
|
-
instance_variables
|
34
|
-
.map { |k| k.to_s.sub("@", "") }
|
35
|
-
.filter { |k| k != "data" and k != "client" and respond_to? k }
|
36
|
-
.map { |k| " #{k}=#{send(k).inspect}" }
|
37
|
-
.join("\n") + ">"
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.date_accessor(*attrs)
|
41
|
-
attrs.each do |attr|
|
42
|
-
define_method(attr) do
|
43
|
-
value = instance_variable_get("@#{attr}")
|
44
|
-
|
45
|
-
raise "No value for #{attr} set" if value.nil?
|
46
|
-
|
47
|
-
parse_datetime(value)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
protected
|
53
|
-
|
54
|
-
def parse_datetime(value)
|
55
|
-
Time.parse(value)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/seamapi.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/seam/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "seamapi"
|
7
|
-
spec.version = Seam::VERSION
|
8
|
-
spec.authors = ["Abimael Martell"]
|
9
|
-
spec.email = ["abi@getseam.com"]
|
10
|
-
|
11
|
-
spec.summary = "Seam API Ruby Library"
|
12
|
-
spec.description = "seamapi is a Ruby gem that provides a simple interface to Seam Connect's API."
|
13
|
-
spec.homepage = "https://github.com/seamapi/ruby"
|
14
|
-
spec.required_ruby_version = ">= 2.6.0"
|
15
|
-
|
16
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
-
spec.metadata["source_code_uri"] = "https://github.com/seamapi/ruby"
|
18
|
-
|
19
|
-
spec.files = Dir.chdir(__dir__) do
|
20
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
21
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
22
|
-
end
|
23
|
-
end
|
24
|
-
spec.bindir = "exe"
|
25
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
26
|
-
spec.require_paths = ["lib"]
|
27
|
-
|
28
|
-
spec.add_dependency "http", "~> 5.0.0"
|
29
|
-
spec.add_development_dependency "webmock", "~> 3.0.0"
|
30
|
-
end
|
data/sig/seamapi.rbs
DELETED