seam 1.1.3 → 2.0.0a2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +4 -2
  3. data/Gemfile.lock +137 -0
  4. data/LICENSE.txt +16 -18
  5. data/README.md +118 -115
  6. data/Rakefile +23 -0
  7. data/lib/seam/client.rb +129 -0
  8. data/lib/seam/clients/access_codes.rb +95 -0
  9. data/lib/seam/clients/access_codes_simulate.rb +17 -0
  10. data/lib/seam/clients/access_codes_unmanaged.rb +57 -0
  11. data/lib/seam/clients/acs.rb +35 -0
  12. data/lib/seam/clients/acs_access_groups.rb +57 -0
  13. data/lib/seam/clients/acs_credential_pools.rb +17 -0
  14. data/lib/seam/clients/acs_credential_provisioning_automations.rb +17 -0
  15. data/lib/seam/clients/acs_credentials.rb +77 -0
  16. data/lib/seam/clients/acs_entrances.rb +47 -0
  17. data/lib/seam/clients/acs_systems.rb +27 -0
  18. data/lib/seam/clients/acs_users.rb +117 -0
  19. data/lib/seam/clients/action_attempts.rb +30 -0
  20. data/lib/seam/clients/base_client.rb +21 -0
  21. data/lib/seam/clients/client_sessions.rb +77 -0
  22. data/lib/seam/clients/connect_webviews.rb +47 -0
  23. data/lib/seam/clients/connected_accounts.rb +47 -0
  24. data/lib/seam/clients/devices.rb +65 -0
  25. data/lib/seam/clients/devices_simulate.rb +17 -0
  26. data/lib/seam/clients/devices_unmanaged.rb +37 -0
  27. data/lib/seam/clients/events.rb +27 -0
  28. data/lib/seam/clients/locks.rb +53 -0
  29. data/lib/seam/clients/networks.rb +27 -0
  30. data/lib/seam/clients/noise_sensors.rb +15 -0
  31. data/lib/seam/clients/noise_sensors_noise_thresholds.rb +57 -0
  32. data/lib/seam/clients/noise_sensors_simulate.rb +17 -0
  33. data/lib/seam/clients/phones.rb +31 -0
  34. data/lib/seam/clients/phones_simulate.rb +17 -0
  35. data/lib/seam/clients/thermostats.rb +106 -0
  36. data/lib/seam/clients/thermostats_climate_setting_schedules.rb +57 -0
  37. data/lib/seam/clients/user_identities.rb +131 -0
  38. data/lib/seam/clients/user_identities_enrollment_automations.rb +47 -0
  39. data/lib/seam/clients/webhooks.rb +57 -0
  40. data/lib/seam/clients/workspaces.rb +50 -0
  41. data/lib/seam/logger.rb +12 -0
  42. data/lib/seam/lts_version.rb +5 -0
  43. data/lib/seam/request.rb +73 -0
  44. data/lib/seam/resources/access_code.rb +12 -0
  45. data/lib/seam/resources/acs_access_group.rb +9 -0
  46. data/lib/seam/resources/acs_credential.rb +12 -0
  47. data/lib/seam/resources/acs_credential_pool.rb +9 -0
  48. data/lib/seam/resources/acs_credential_provisioning_automation.rb +9 -0
  49. data/lib/seam/resources/acs_entrance.rb +9 -0
  50. data/lib/seam/resources/acs_system.rb +9 -0
  51. data/lib/seam/resources/acs_user.rb +9 -0
  52. data/lib/seam/resources/action_attempt.rb +46 -0
  53. data/lib/seam/resources/base_resource.rb +58 -0
  54. data/lib/seam/resources/client_session.rb +9 -0
  55. data/lib/seam/resources/climate_setting_schedule.rb +11 -0
  56. data/lib/seam/resources/connect_webview.rb +9 -0
  57. data/lib/seam/resources/connected_account.rb +12 -0
  58. data/lib/seam/resources/device.rb +12 -0
  59. data/lib/seam/resources/device_provider.rb +7 -0
  60. data/lib/seam/resources/enrollment_automation.rb +9 -0
  61. data/lib/seam/resources/event.rb +9 -0
  62. data/lib/seam/resources/network.rb +9 -0
  63. data/lib/seam/resources/noise_threshold.rb +7 -0
  64. data/lib/seam/resources/phone.rb +12 -0
  65. data/lib/seam/resources/resource_error.rb +9 -0
  66. data/lib/seam/resources/resource_errors_support.rb +9 -0
  67. data/lib/seam/resources/resource_warning.rb +9 -0
  68. data/lib/seam/resources/resource_warnings_support.rb +9 -0
  69. data/lib/seam/resources/service_health.rb +7 -0
  70. data/lib/seam/resources/unmanaged_access_code.rb +12 -0
  71. data/lib/seam/resources/unmanaged_device.rb +12 -0
  72. data/lib/seam/resources/user_identity.rb +9 -0
  73. data/lib/seam/resources/webhook.rb +7 -0
  74. data/lib/seam/resources/workspace.rb +7 -0
  75. data/lib/seam/version.rb +3 -1
  76. data/lib/seam.rb +71 -13
  77. metadata +147 -82
  78. data/.gitignore +0 -18
  79. data/lib/seam/effort.rb +0 -86
  80. data/lib/seam/flow.rb +0 -53
  81. data/lib/seam/in_memory.rb +0 -13
  82. data/lib/seam/persistence.rb +0 -43
  83. data/lib/seam/step.rb +0 -33
  84. data/lib/seam/wait_worker.rb +0 -30
  85. data/lib/seam/worker.rb +0 -166
  86. data/seam.gemspec +0 -30
  87. data/spec/seam/effort_spec.rb +0 -43
  88. data/spec/seam/flow_spec.rb +0 -173
  89. data/spec/seam/step_spec.rb +0 -34
  90. data/spec/seam/wait_worker_spec.rb +0 -179
  91. data/spec/seam/worker_spec.rb +0 -973
  92. data/spec/spec_helper.rb +0 -8
@@ -1,34 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe Seam::Step do
4
- describe "initialize" do
5
- it "should allow values to be set with the constructor" do
6
- step = Seam::Step.new( { id: 'an id',
7
- name: 'a name',
8
- type: 'a type',
9
- arguments: ['1234', 2] } )
10
- step.id.must_equal 'an id'
11
- step.name.must_equal 'a name'
12
- step.type.must_equal 'a type'
13
- step.arguments.count.must_equal 2
14
- step.arguments[0].must_equal '1234'
15
- step.arguments[1].must_equal 2
16
- end
17
- end
18
-
19
- describe "to hash" do
20
- it "should allow values to be set with the constructor" do
21
- step = Seam::Step.new( { id: 'an id',
22
- name: 'a name',
23
- type: 'a type',
24
- arguments: ['1234', 2] } )
25
- step = Seam::Step.new step.to_hash
26
- step.id.must_equal 'an id'
27
- step.name.must_equal 'a name'
28
- step.type.must_equal 'a type'
29
- step.arguments.count.must_equal 2
30
- step.arguments[0].must_equal '1234'
31
- step.arguments[1].must_equal 2
32
- end
33
- end
34
- end
@@ -1,179 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- class DoSomething < Seam::Worker
4
- def process
5
- end
6
- end
7
-
8
- describe Seam::WaitWorker do
9
-
10
- it "should be a worker" do
11
- Seam::WaitWorker.new.is_a? Seam::Worker
12
- end
13
-
14
- it "should handle the wait step" do
15
- Seam::WaitWorker.new.step.must_equal 'wait'
16
- end
17
-
18
- let(:today) do
19
- Time.parse '1/1/2011'
20
- end
21
-
22
- let(:effort_id) do
23
- effort = flow.start
24
- effort.id
25
- end
26
-
27
- describe "using it in a flow" do
28
-
29
- [:length_of_time].to_objects { [
30
- [3.days],
31
- [1.day],
32
- [30.minutes]
33
- ] }.each do |test|
34
-
35
- describe "a simple situation" do
36
-
37
- let(:flow) do
38
- f = Seam::Flow.new
39
- f.wait test.length_of_time
40
- f.do_something
41
- f
42
- end
43
-
44
- before do
45
- Timecop.freeze today
46
- effort_id
47
- end
48
-
49
- it "should move to the next step" do
50
- Seam::WaitWorker.new.execute_all
51
- Seam::Effort.find(effort_id).next_step.must_equal "do_something"
52
- end
53
- j
54
- it "should set the next execute date" do
55
- Seam::WaitWorker.new.execute_all
56
- Seam::Effort.find(effort_id).next_execute_at.must_equal (today + test.length_of_time)
57
- end
58
-
59
- end
60
-
61
- end
62
-
63
- describe "time has passed since the flow was started and the wait worker was called" do
64
-
65
- let(:today) { Time.parse('1/1/2011') }
66
- let(:time_to_wait) { 3.days }
67
- let(:time_before_wait_worker_was_called) { 1.day }
68
- let(:expected_start) { today + time_to_wait }
69
-
70
- let(:flow) do
71
- f = Seam::Flow.new
72
- f.wait time_to_wait
73
- f.do_something
74
- f
75
- end
76
-
77
- before do
78
- Timecop.freeze today
79
- effort_id
80
-
81
- Timecop.freeze today + time_before_wait_worker_was_called
82
- end
83
-
84
- it "should move to the next step" do
85
- Seam::WaitWorker.new.execute_all
86
- Seam::Effort.find(effort_id).next_step.must_equal "do_something"
87
- end
88
-
89
- it "should set the next execute date" do
90
- Seam::WaitWorker.new.execute_all
91
- Seam::Effort.find(effort_id).next_execute_at.must_equal expected_start
92
- end
93
-
94
- end
95
-
96
- describe "time has passed since the last step was started and the wait worker was called" do
97
-
98
- let(:today) { Time.parse('1/1/2011') }
99
- let(:time_to_wait) { 8.days }
100
- let(:time_it_took_for_previous_step) { 1.days }
101
- let(:time_before_wait_worker_was_called) { 3.day }
102
- let(:expected_start) { today + time_to_wait + time_it_took_for_previous_step }
103
-
104
- let(:flow) do
105
- f = Seam::Flow.new
106
- f.do_something
107
- f.wait time_to_wait
108
- f.do_something
109
- f
110
- end
111
-
112
- before do
113
- Timecop.freeze today
114
- effort_id
115
-
116
- Timecop.freeze Time.now + time_it_took_for_previous_step
117
- DoSomething.new.execute_all
118
- Timecop.freeze Time.now + time_before_wait_worker_was_called
119
- end
120
-
121
- it "should move to the next step" do
122
- Seam::WaitWorker.new.execute_all
123
- Seam::Effort.find(effort_id).next_step.must_equal "do_something"
124
- end
125
-
126
- it "should set the next execute date" do
127
- Seam::WaitWorker.new.execute_all
128
- Seam::Effort.find(effort_id).next_execute_at.must_equal expected_start
129
- end
130
-
131
- end
132
- j
133
- describe "a more complex example of waiting" do
134
-
135
- let(:today) { Time.parse('1/1/2011') }
136
- let(:time_to_wait) { 8.days }
137
- let(:time_it_took_for_first_step) { 1.days }
138
- let(:time_it_took_for_second_step) { 4.days }
139
- let(:time_before_wait_worker_was_called) { 3.day }
140
- let(:expected_start) { today +
141
- time_to_wait +
142
- time_it_took_for_first_step +
143
- time_it_took_for_second_step }
144
-
145
- let(:flow) do
146
- f = Seam::Flow.new
147
- f.do_something
148
- f.do_something
149
- f.wait time_to_wait
150
- f.do_something
151
- f
152
- end
153
-
154
- before do
155
- Timecop.freeze today
156
- effort_id
157
-
158
- Timecop.freeze Time.now + time_it_took_for_first_step
159
- DoSomething.new.execute_all
160
- Timecop.freeze Time.now + time_it_took_for_second_step
161
- DoSomething.new.execute_all
162
- Timecop.freeze Time.now + time_before_wait_worker_was_called
163
- end
164
-
165
- it "should move to the next step" do
166
- Seam::WaitWorker.new.execute_all
167
- Seam::Effort.find(effort_id).next_step.must_equal "do_something"
168
- end
169
-
170
- it "should set the next execute date" do
171
- Seam::WaitWorker.new.execute_all
172
- Seam::Effort.find(effort_id).next_execute_at.must_equal expected_start
173
- end
174
-
175
- end
176
-
177
- end
178
-
179
- end