seamapi 0.0.2 → 0.0.3
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 +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/seam/client.rb +1 -1
- data/lib/seam/clients/access_codes.rb +3 -1
- data/lib/seam/clients/base_client.rb +4 -0
- data/lib/seam/clients/locks.rb +2 -2
- data/lib/seam/clients/workspaces.rb +5 -6
- data/lib/seam/resources/access_code.rb +3 -1
- data/lib/seam/resources/action_attempt.rb +19 -7
- data/lib/seam/resources/base_resource.rb +19 -1
- data/lib/seam/resources/connect_webview.rb +3 -1
- data/lib/seam/resources/connected_account.rb +3 -1
- data/lib/seam/resources/device.rb +2 -0
- data/lib/seam/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98c75f0f7e1acbd1349c75b7b7897a7d970707b60a20c473d0005c1616ad299f
|
4
|
+
data.tar.gz: 2985200c8c26d3ad45f544ee54eb1e6baa781e5927f29e846a57281b126f4cec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52710d4889719d6e1e19462009c3b4f3f932e8fd91d62831a486a8eaba5297dfdb017173b6c8264ce427410c5b789430820c2bdcd9226d86d72fff7a25879ca2
|
7
|
+
data.tar.gz: ad802beb44be2e50b944c3acd82a7284b235e54e99440e91d469fe7bbb53dc2aa0f15456b1cfa859376c1625f4009852806cc8f7fbb168e375db2a193597ea15
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/seam/client.rb
CHANGED
data/lib/seam/clients/locks.rb
CHANGED
@@ -40,7 +40,7 @@ module Seam
|
|
40
40
|
:get,
|
41
41
|
"/locks/list",
|
42
42
|
Seam::Device,
|
43
|
-
"
|
43
|
+
"locks",
|
44
44
|
params: params
|
45
45
|
)
|
46
46
|
end
|
@@ -50,7 +50,7 @@ module Seam
|
|
50
50
|
:get,
|
51
51
|
"/locks/get",
|
52
52
|
Seam::Device,
|
53
|
-
"
|
53
|
+
"lock",
|
54
54
|
params: {
|
55
55
|
device_id: device_id(device_or_id)
|
56
56
|
}
|
@@ -23,12 +23,11 @@ module Seam
|
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
26
|
-
def reset_sandbox
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
:post, "/workspaces/reset_sandbox", {}
|
26
|
+
def reset_sandbox(workspace_id)
|
27
|
+
request_seam(
|
28
|
+
:post,
|
29
|
+
"/workspaces/reset_sandbox",
|
30
|
+
params: { workspace_id: workspace_id }
|
32
31
|
)
|
33
32
|
end
|
34
33
|
end
|
@@ -4,17 +4,29 @@ module Seam
|
|
4
4
|
class ActionAttempt < BaseResource
|
5
5
|
attr_accessor :action_attempt_id, :action_type, :status, :result
|
6
6
|
|
7
|
+
SLEEP_TIME = 0.2
|
8
|
+
MAX_ATTEMPTS = 10
|
9
|
+
|
7
10
|
def wait_until_finished
|
8
11
|
while @status == "pending"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
params: { action_attempt_id: @action_attempt_id }
|
13
|
-
)
|
14
|
-
update_from_response(res["action_attempt"])
|
15
|
-
sleep(0.2)
|
12
|
+
update!
|
13
|
+
|
14
|
+
sleep(SLEEP_TIME)
|
16
15
|
end
|
16
|
+
|
17
17
|
self
|
18
18
|
end
|
19
|
+
|
20
|
+
def update!
|
21
|
+
response = @client.request_seam(
|
22
|
+
:get,
|
23
|
+
"/action_attempts/get",
|
24
|
+
params: {
|
25
|
+
action_attempt_id: action_attempt_id
|
26
|
+
}
|
27
|
+
)
|
28
|
+
|
29
|
+
update_from_response(response["action_attempt"])
|
30
|
+
end
|
19
31
|
end
|
20
32
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Seam
|
4
4
|
class BaseResource
|
5
|
-
attr_accessor :data
|
5
|
+
attr_accessor :data, :client
|
6
6
|
|
7
7
|
def initialize(data, client = nil)
|
8
8
|
@data = data
|
@@ -36,5 +36,23 @@ module Seam
|
|
36
36
|
.map { |k| " #{k}=#{send(k).inspect}" }
|
37
37
|
.join("\n") + ">"
|
38
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
|
39
57
|
end
|
40
58
|
end
|
@@ -3,7 +3,9 @@
|
|
3
3
|
module Seam
|
4
4
|
class ConnectWebview < BaseResource
|
5
5
|
attr_accessor :connect_webview_id, :custom_redirect_url, :url, :workspace_id, :device_selection_mode,
|
6
|
-
:accepted_providers, :accepted_devices, :any_provider_allowed, :any_device_allowed,
|
6
|
+
:accepted_providers, :accepted_devices, :any_provider_allowed, :any_device_allowed,
|
7
7
|
:login_successful, :status
|
8
|
+
|
9
|
+
date_accessor :created_at
|
8
10
|
end
|
9
11
|
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: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abimael Martell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|