sidemash-sdk 0.1.0 → 0.1.1

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +58 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +203 -0
  8. data/README.md +43 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/exe/sidemash-sdk +3 -0
  13. data/lib/sidemash/sdk/auth.rb +75 -0
  14. data/lib/sidemash/sdk/client.rb +36 -0
  15. data/lib/sidemash/sdk/create_stream_square_form.rb +114 -0
  16. data/lib/sidemash/sdk/domain.rb +24 -0
  17. data/lib/sidemash/sdk/hook.rb +71 -0
  18. data/lib/sidemash/sdk/hook_http_call.rb +75 -0
  19. data/lib/sidemash/sdk/hook_ws_call.rb +75 -0
  20. data/lib/sidemash/sdk/hook_zoom.rb +41 -0
  21. data/lib/sidemash/sdk/http.rb +112 -0
  22. data/lib/sidemash/sdk/http_call_error.rb +13 -0
  23. data/lib/sidemash/sdk/http_method.rb +119 -0
  24. data/lib/sidemash/sdk/http_request.rb +32 -0
  25. data/lib/sidemash/sdk/instance_status.rb +175 -0
  26. data/lib/sidemash/sdk/list_form.rb +95 -0
  27. data/lib/sidemash/sdk/pagination.rb +116 -0
  28. data/lib/sidemash/sdk/play.rb +68 -0
  29. data/lib/sidemash/sdk/publish.rb +68 -0
  30. data/lib/sidemash/sdk/publish_rtmp.rb +82 -0
  31. data/lib/sidemash/sdk/rest_collection.rb +65 -0
  32. data/lib/sidemash/sdk/secure_and_non_secure.rb +82 -0
  33. data/lib/sidemash/sdk/stream_meta_data.rb +68 -0
  34. data/lib/sidemash/sdk/stream_square.rb +148 -0
  35. data/lib/sidemash/sdk/stream_square_rest_collection.rb +82 -0
  36. data/lib/sidemash/sdk/stream_square_service.rb +56 -0
  37. data/lib/sidemash/sdk/stream_square_size.rb +119 -0
  38. data/lib/sidemash/sdk/timestamp.rb +68 -0
  39. data/lib/sidemash/sdk/update_stream_square_form.rb +100 -0
  40. data/lib/sidemash/sdk/user_desc.rb +68 -0
  41. data/lib/sidemash/sdk/utc_date_time.rb +75 -0
  42. data/lib/sidemash/sdk/version.rb +5 -0
  43. data/lib/sidemash/sdk.rb +39 -0
  44. data/sidemash-sdk.gemspec +31 -0
  45. metadata +48 -4
@@ -0,0 +1,82 @@
1
+ =begin
2
+ Copyright © 2020 Sidemash Cloud Services
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing,
11
+ software distributed under the License is distributed on an
12
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13
+ either express or implied. See the License for the specific
14
+ language governing permissions and limitations under the License.
15
+ =end
16
+
17
+
18
+
19
+
20
+ module Sidemash::Sdk
21
+ class SecureAndNonSecure
22
+ attr_reader :secure
23
+ attr_reader :non_secure_on80
24
+ attr_reader :non_secure
25
+
26
+ def initialize(secure, non_secure_on80, non_secure)
27
+ @_type = 'SecureAndNonSecure'
28
+ @secure = secure
29
+ @non_secure_on80 = non_secure_on80
30
+ @non_secure = non_secure
31
+ end
32
+
33
+ def self._type
34
+ 'SecureAndNonSecure'
35
+ end
36
+
37
+ def self.from_json(js)
38
+ h = JSON.parse(js)
39
+ SecureAndNonSecure.from_hash(h)
40
+ end
41
+
42
+ def to_remote
43
+ result = {}
44
+ result[:_type] = @_type
45
+ result[:secure] = @secure
46
+ result[:nonSecureOn80] = @non_secure_on80
47
+ result[:nonSecure] = @non_secure
48
+ result
49
+ end
50
+
51
+ def to_hash
52
+ result = {}
53
+ result[:_type] = @_type
54
+ result[:secure] = @secure
55
+ result[:non_secure_on80] = @non_secure_on80
56
+ result[:non_secure] = @non_secure
57
+ result
58
+ end
59
+
60
+ def self.from_remote(h)
61
+ SecureAndNonSecure.new(h['secure'],
62
+ h['nonSecureOn80'],
63
+ h['nonSecure'])
64
+ end
65
+
66
+ def self.from_hash(h)
67
+ SecureAndNonSecure.new(h['secure'],
68
+ h['non_secure_on80'],
69
+ h['non_secure'])
70
+ end
71
+
72
+ def to_json(*a)
73
+ to_hash.to_json(*a)
74
+ end
75
+
76
+ def to_s
77
+ ('SecureAndNonSecure(secure=' + @secure +
78
+ ', non_secure_on80=' + @non_secure_on80 +
79
+ ', non_secure=' + @non_secure + ')')
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,68 @@
1
+ =begin
2
+ Copyright © 2020 Sidemash Cloud Services
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing,
11
+ software distributed under the License is distributed on an
12
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13
+ either express or implied. See the License for the specific
14
+ language governing permissions and limitations under the License.
15
+ =end
16
+
17
+
18
+
19
+
20
+ module Sidemash::Sdk
21
+ class StreamMetaData
22
+ attr_reader :todo
23
+
24
+ def initialize(todo)
25
+ @_type = 'StreamMetaData'
26
+ @todo = todo
27
+ end
28
+
29
+ def self._type
30
+ 'StreamMetaData'
31
+ end
32
+
33
+ def self.from_json(js)
34
+ h = JSON.parse(js)
35
+ StreamMetaData.from_hash(h)
36
+ end
37
+
38
+ def to_remote
39
+ result = {}
40
+ result[:_type] = @_type
41
+ result[:todo] = @todo
42
+ result
43
+ end
44
+
45
+ def to_hash
46
+ result = {}
47
+ result[:_type] = @_type
48
+ result[:todo] = @todo
49
+ result
50
+ end
51
+
52
+ def self.from_remote(h)
53
+ StreamMetaData.new(h['todo'])
54
+ end
55
+
56
+ def self.from_hash(h)
57
+ StreamMetaData.new(h['todo'])
58
+ end
59
+
60
+ def to_json(*a)
61
+ to_hash.to_json(*a)
62
+ end
63
+
64
+ def to_s
65
+ 'StreamMetaData(todo=' + @todo + ')'
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,148 @@
1
+ =begin
2
+ Copyright © 2020 Sidemash Cloud Services
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing,
11
+ software distributed under the License is distributed on an
12
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13
+ either express or implied. See the License for the specific
14
+ language governing permissions and limitations under the License.
15
+ =end
16
+
17
+
18
+
19
+
20
+ module Sidemash::Sdk
21
+ class StreamSquare
22
+ attr_reader :id
23
+ attr_reader :url
24
+ attr_reader :status
25
+ attr_reader :is_elastic
26
+ attr_reader :size
27
+ attr_reader :play_domain_name
28
+ attr_reader :publish_domain_name
29
+ attr_reader :publish
30
+ attr_reader :hook
31
+ attr_reader :description
32
+ attr_reader :foreign_data
33
+
34
+ def initialize(id,
35
+ url,
36
+ status,
37
+ is_elastic,
38
+ size,
39
+ play_domain_name,
40
+ publish_domain_name,
41
+ publish,
42
+ hook,
43
+ description,
44
+ foreign_data)
45
+ @_type = 'StreamSquare'
46
+ @id = id
47
+ @url = url
48
+ @status = status
49
+ @is_elastic = is_elastic
50
+ @size = size
51
+ @play_domain_name = play_domain_name
52
+ @publish_domain_name = publish_domain_name
53
+ @publish = publish
54
+ @hook = hook
55
+ @description = description
56
+ @foreign_data = foreign_data
57
+ end
58
+
59
+ def self._type
60
+ 'StreamSquare'
61
+ end
62
+
63
+ def self.from_json(js)
64
+ h = JSON.parse(js)
65
+ StreamSquare.from_hash(h)
66
+ end
67
+
68
+ def to_remote
69
+ result = {}
70
+ result[:_type] = @_type
71
+ result[:id] = @id
72
+ result[:url] = @url
73
+ result[:status] = @status.to_s
74
+ result[:isElastic] = @is_elastic
75
+ result[:size] = @size.to_s
76
+ result[:playDomainName] = @play_domain_name unless @play_domain_name.nil?
77
+ result[:publishDomainName] = @publish_domain_name unless @publish_domain_name.nil?
78
+ result[:publish] = @publish.to_remote
79
+ result[:hook] = @hook.to_remote
80
+ result[:description] = @description unless @description.nil?
81
+ result[:foreignData] = @foreign_data unless @foreign_data.nil?
82
+ result
83
+ end
84
+
85
+ def to_hash
86
+ result = {}
87
+ result[:_type] = @_type
88
+ result[:id] = @id
89
+ result[:url] = @url
90
+ result[:status] = @status.to_s
91
+ result[:is_elastic] = @is_elastic
92
+ result[:size] = @size.to_s
93
+ result[:play_domain_name] = @play_domain_name unless @play_domain_name.nil?
94
+ result[:publish_domain_name] = @publish_domain_name unless @publish_domain_name.nil?
95
+ result[:publish] = @publish.to_hash
96
+ result[:hook] = @hook.to_hash
97
+ result[:description] = @description unless @description.nil?
98
+ result[:foreign_data] = @foreign_data unless @foreign_data.nil?
99
+ result
100
+ end
101
+
102
+ def self.from_remote(h)
103
+ StreamSquare.new(h['id'],
104
+ h['url'],
105
+ InstanceStatus.from_s(h['status']),
106
+ h['isElastic'],
107
+ StreamSquareSize.from_s(h['size']),
108
+ h['playDomainName'].nil? ? h['playDomainName'] : nil,
109
+ h['publishDomainName'].nil? ? h['publishDomainName'] : nil,
110
+ Publish.from_remote(h['publish']),
111
+ Hook.from_remote(h['hook']),
112
+ h['description'].nil? ? h['description'] : nil,
113
+ h['foreignData'].nil? ? h['foreignData'] : nil)
114
+ end
115
+
116
+ def self.from_hash(h)
117
+ StreamSquare.new(h['id'],
118
+ h['url'],
119
+ InstanceStatus.from_s(h['status']),
120
+ h['is_elastic'],
121
+ StreamSquareSize.from_s(h['size']),
122
+ h['play_domain_name'].nil? ? h['play_domain_name'] : nil,
123
+ h['publish_domain_name'].nil? ? h['publish_domain_name'] : nil,
124
+ Publish.from_hash(h['publish']),
125
+ Hook.from_hash(h['hook']),
126
+ h['description'].nil? ? h['description'] : nil,
127
+ h['foreign_data'].nil? ? h['foreign_data'] : nil)
128
+ end
129
+
130
+ def to_json(*a)
131
+ to_hash.to_json(*a)
132
+ end
133
+
134
+ def to_s
135
+ ('StreamSquare(id=' + @id +
136
+ ', url=' + @url +
137
+ ', status=' + @status.to_s +
138
+ ', is_elastic=' + @is_elastic +
139
+ ', size=' + @size.to_s +
140
+ ', play_domain_name=' + @play_domain_name +
141
+ ', publish_domain_name=' + @publish_domain_name +
142
+ ', publish=' + @publish.to_s +
143
+ ', hook=' + @hook.to_s +
144
+ ', description=' + @description +
145
+ ', foreign_data=' + @foreign_data + ')')
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,82 @@
1
+ =begin
2
+ Copyright © 2020 Sidemash Cloud Services
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing,
11
+ software distributed under the License is distributed on an
12
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13
+ either express or implied. See the License for the specific
14
+ language governing permissions and limitations under the License.
15
+ =end
16
+
17
+
18
+
19
+
20
+ module Sidemash::Sdk
21
+ class StreamSquareRestCollection
22
+ attr_reader :url
23
+ attr_reader :pagination
24
+ attr_reader :items
25
+
26
+ def initialize(url, pagination, items)
27
+ @_type = 'StreamSquareRestCollection'
28
+ @url = url
29
+ @pagination = pagination
30
+ @items = items
31
+ end
32
+
33
+ def self._type
34
+ 'StreamSquareRestCollection'
35
+ end
36
+
37
+ def self.from_json(js)
38
+ h = JSON.parse(js)
39
+ StreamSquareRestCollection.from_hash(h)
40
+ end
41
+
42
+ def to_remote
43
+ result = {}
44
+ result[:_type] = @_type
45
+ result[:url] = @url
46
+ result[:pagination] = @pagination.to_remote
47
+ result[:items] = @items.map { |el| el.to_remote }
48
+ result
49
+ end
50
+
51
+ def to_hash
52
+ result = {}
53
+ result[:_type] = @_type
54
+ result[:url] = @url
55
+ result[:pagination] = @pagination.to_hash
56
+ result[:items] = @items.map { |el| el.to_hash }
57
+ result
58
+ end
59
+
60
+ def self.from_remote(h)
61
+ StreamSquareRestCollection.new(h['url'],
62
+ Pagination.from_remote(h['pagination']),
63
+ h['items'].map { |item_hash| StreamSquare.from_remote(item_hash) })
64
+ end
65
+
66
+ def self.from_hash(h)
67
+ StreamSquareRestCollection.new(h['url'],
68
+ Pagination.from_hash(h['pagination']),
69
+ h['items'].map { |item_hash| StreamSquare.from_hash(item_hash) })
70
+ end
71
+
72
+ def to_json(*a)
73
+ to_hash.to_json(*a)
74
+ end
75
+
76
+ def to_s
77
+ ('StreamSquareRestCollection(url=' + @url +
78
+ ', pagination=' + @pagination.to_s +
79
+ ', items=' + @items.to_s + ')')
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,56 @@
1
+ =begin
2
+ Copyright © 2020 Sidemash Cloud Services
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing,
11
+ software distributed under the License is distributed on an
12
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13
+ either express or implied. See the License for the specific
14
+ language governing permissions and limitations under the License.
15
+ =end
16
+
17
+
18
+
19
+
20
+ module Sidemash::Sdk
21
+ class StreamSquareService
22
+ def initialize(auth)
23
+ @_type = 'StreamSquareService'
24
+ @auth = auth
25
+ end
26
+
27
+ def create(form)
28
+ remote = Http.post('/' + Http.version + '/stream-squares', form.to_json, "", {}, @auth)
29
+ StreamSquare.from_hash(remote)
30
+ end
31
+
32
+ def get(id)
33
+ remote = Http.get('/' + Http.version + '/stream-squares/' + id, "", {}, @auth)
34
+ StreamSquare.from_hash(remote)
35
+ end
36
+
37
+ def list(form = nil)
38
+ qs = form.nil? ? ListForm.empty.to_query_string : form.to_query_string
39
+ remote = Http.list('/' + Http.version + '/stream-squares', qs, {}, @auth)
40
+ StreamSquareRestCollection.from_hash(remote)
41
+ end
42
+
43
+ def update(form)
44
+ remote = Http.patch('/' + Http.version + '/stream-squares/' + form.id, form.to_json, "", {}, @auth)
45
+ StreamSquare.from_hash(remote)
46
+ end
47
+
48
+ def delete(id)
49
+ Http.delete('/' + Http.version + '/stream-squares/' + id, nil, "", {}, @auth)
50
+ end
51
+
52
+ def to_s
53
+ 'StreamSquareService(auth=' + @auth.to_s + ')'
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,119 @@
1
+ =begin
2
+ Copyright © 2020 Sidemash Cloud Services
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing,
11
+ software distributed under the License is distributed on an
12
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13
+ either express or implied. See the License for the specific
14
+ language governing permissions and limitations under the License.
15
+ =end
16
+
17
+
18
+
19
+
20
+ module Sidemash::Sdk
21
+ class StreamSquareSize
22
+ attr_reader :value
23
+
24
+ def initialize(value)
25
+ @value = value
26
+ end
27
+
28
+ def self.s
29
+ StreamSquareSize.new('S')
30
+ end
31
+
32
+ def self.m
33
+ StreamSquareSize.new('M')
34
+ end
35
+
36
+ def self.l
37
+ StreamSquareSize.new('L')
38
+ end
39
+
40
+ def self.xl
41
+ StreamSquareSize.new('XL')
42
+ end
43
+
44
+ def self.xxl
45
+ StreamSquareSize.new('XXL')
46
+ end
47
+
48
+ def self.all_possibles_values
49
+ Set['S',
50
+ 'M',
51
+ 'L',
52
+ 'XL',
53
+ 'XXL']
54
+ end
55
+
56
+ def self.from_s(value)
57
+ case value
58
+ when 'S' then StreamSquareSize.s
59
+ when 'M' then StreamSquareSize.m
60
+ when 'L' then StreamSquareSize.l
61
+ when 'XL' then StreamSquareSize.xl
62
+ when 'XXL' then StreamSquareSize.xxl
63
+ else nil
64
+ end
65
+ end
66
+
67
+ def self.valid?(value)
68
+ StreamSquareSize.all_possibles_values.include? value
69
+ end
70
+
71
+ def not_s?
72
+ @value != 'S'
73
+ end
74
+
75
+ def not_m?
76
+ @value != 'M'
77
+ end
78
+
79
+ def not_l?
80
+ @value != 'L'
81
+ end
82
+
83
+ def not_xl?
84
+ @value != 'XL'
85
+ end
86
+
87
+ def not_xxl?
88
+ @value != 'XXL'
89
+ end
90
+
91
+ def s?
92
+ @value == 'S'
93
+ end
94
+
95
+ def m?
96
+ @value == 'M'
97
+ end
98
+
99
+ def l?
100
+ @value == 'L'
101
+ end
102
+
103
+ def xl?
104
+ @value == 'XL'
105
+ end
106
+
107
+ def xxl?
108
+ @value == 'XXL'
109
+ end
110
+
111
+ def to_json(*a)
112
+ @value
113
+ end
114
+
115
+ def to_s
116
+ @value
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,68 @@
1
+ =begin
2
+ Copyright © 2020 Sidemash Cloud Services
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing,
11
+ software distributed under the License is distributed on an
12
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13
+ either express or implied. See the License for the specific
14
+ language governing permissions and limitations under the License.
15
+ =end
16
+
17
+
18
+
19
+
20
+ module Sidemash::Sdk
21
+ class Timestamp
22
+ attr_reader :seconds
23
+
24
+ def initialize(seconds)
25
+ @_type = 'Timestamp'
26
+ @seconds = seconds
27
+ end
28
+
29
+ def self._type
30
+ 'Timestamp'
31
+ end
32
+
33
+ def self.from_json(js)
34
+ h = JSON.parse(js)
35
+ Timestamp.from_hash(h)
36
+ end
37
+
38
+ def to_remote
39
+ result = {}
40
+ result[:_type] = @_type
41
+ result[:seconds] = @seconds
42
+ result
43
+ end
44
+
45
+ def to_hash
46
+ result = {}
47
+ result[:_type] = @_type
48
+ result[:seconds] = @seconds
49
+ result
50
+ end
51
+
52
+ def self.from_remote(h)
53
+ Timestamp.new(h['seconds'])
54
+ end
55
+
56
+ def self.from_hash(h)
57
+ Timestamp.new(h['seconds'])
58
+ end
59
+
60
+ def to_json(*a)
61
+ to_hash.to_json(*a)
62
+ end
63
+
64
+ def to_s
65
+ 'Timestamp(seconds=' + @seconds + ')'
66
+ end
67
+ end
68
+ end