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.
- checksums.yaml +4 -4
- data/.gitignore +58 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +3 -0
- data/LICENSE +203 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/sidemash-sdk +3 -0
- data/lib/sidemash/sdk/auth.rb +75 -0
- data/lib/sidemash/sdk/client.rb +36 -0
- data/lib/sidemash/sdk/create_stream_square_form.rb +114 -0
- data/lib/sidemash/sdk/domain.rb +24 -0
- data/lib/sidemash/sdk/hook.rb +71 -0
- data/lib/sidemash/sdk/hook_http_call.rb +75 -0
- data/lib/sidemash/sdk/hook_ws_call.rb +75 -0
- data/lib/sidemash/sdk/hook_zoom.rb +41 -0
- data/lib/sidemash/sdk/http.rb +112 -0
- data/lib/sidemash/sdk/http_call_error.rb +13 -0
- data/lib/sidemash/sdk/http_method.rb +119 -0
- data/lib/sidemash/sdk/http_request.rb +32 -0
- data/lib/sidemash/sdk/instance_status.rb +175 -0
- data/lib/sidemash/sdk/list_form.rb +95 -0
- data/lib/sidemash/sdk/pagination.rb +116 -0
- data/lib/sidemash/sdk/play.rb +68 -0
- data/lib/sidemash/sdk/publish.rb +68 -0
- data/lib/sidemash/sdk/publish_rtmp.rb +82 -0
- data/lib/sidemash/sdk/rest_collection.rb +65 -0
- data/lib/sidemash/sdk/secure_and_non_secure.rb +82 -0
- data/lib/sidemash/sdk/stream_meta_data.rb +68 -0
- data/lib/sidemash/sdk/stream_square.rb +148 -0
- data/lib/sidemash/sdk/stream_square_rest_collection.rb +82 -0
- data/lib/sidemash/sdk/stream_square_service.rb +56 -0
- data/lib/sidemash/sdk/stream_square_size.rb +119 -0
- data/lib/sidemash/sdk/timestamp.rb +68 -0
- data/lib/sidemash/sdk/update_stream_square_form.rb +100 -0
- data/lib/sidemash/sdk/user_desc.rb +68 -0
- data/lib/sidemash/sdk/utc_date_time.rb +75 -0
- data/lib/sidemash/sdk/version.rb +5 -0
- data/lib/sidemash/sdk.rb +39 -0
- data/sidemash-sdk.gemspec +31 -0
- metadata +48 -4
|
@@ -0,0 +1,175 @@
|
|
|
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 InstanceStatus
|
|
22
|
+
attr_reader :value
|
|
23
|
+
|
|
24
|
+
def initialize(value)
|
|
25
|
+
@value = value
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.initializing
|
|
29
|
+
InstanceStatus.new('Initializing')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.running
|
|
33
|
+
InstanceStatus.new('Running')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.restarting
|
|
37
|
+
InstanceStatus.new('Restarting')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.updating
|
|
41
|
+
InstanceStatus.new('Updating')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.maintaining
|
|
45
|
+
InstanceStatus.new('Maintaining')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.partially_available
|
|
49
|
+
InstanceStatus.new('PartiallyAvailable')
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.not_available
|
|
53
|
+
InstanceStatus.new('NotAvailable')
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.terminating
|
|
57
|
+
InstanceStatus.new('Terminating')
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.terminated
|
|
61
|
+
InstanceStatus.new('Terminated')
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def self.all_possibles_values
|
|
65
|
+
Set['Initializing',
|
|
66
|
+
'Running',
|
|
67
|
+
'Restarting',
|
|
68
|
+
'Updating',
|
|
69
|
+
'Maintaining',
|
|
70
|
+
'PartiallyAvailable',
|
|
71
|
+
'NotAvailable',
|
|
72
|
+
'Terminating',
|
|
73
|
+
'Terminated']
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def self.from_s(value)
|
|
77
|
+
case value
|
|
78
|
+
when 'Initializing' then InstanceStatus.initializing
|
|
79
|
+
when 'Running' then InstanceStatus.running
|
|
80
|
+
when 'Restarting' then InstanceStatus.restarting
|
|
81
|
+
when 'Updating' then InstanceStatus.updating
|
|
82
|
+
when 'Maintaining' then InstanceStatus.maintaining
|
|
83
|
+
when 'PartiallyAvailable' then InstanceStatus.partially_available
|
|
84
|
+
when 'NotAvailable' then InstanceStatus.not_available
|
|
85
|
+
when 'Terminating' then InstanceStatus.terminating
|
|
86
|
+
when 'Terminated' then InstanceStatus.terminated
|
|
87
|
+
else nil
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def self.valid?(value)
|
|
92
|
+
InstanceStatus.all_possibles_values.include? value
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def not_initializing?
|
|
96
|
+
@value != 'Initializing'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def not_running?
|
|
100
|
+
@value != 'Running'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def not_restarting?
|
|
104
|
+
@value != 'Restarting'
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def not_updating?
|
|
108
|
+
@value != 'Updating'
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def not_maintaining?
|
|
112
|
+
@value != 'Maintaining'
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def not_partially_available?
|
|
116
|
+
@value != 'PartiallyAvailable'
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def not_not_available?
|
|
120
|
+
@value != 'NotAvailable'
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def not_terminating?
|
|
124
|
+
@value != 'Terminating'
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def not_terminated?
|
|
128
|
+
@value != 'Terminated'
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def initializing?
|
|
132
|
+
@value == 'Initializing'
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def running?
|
|
136
|
+
@value == 'Running'
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def restarting?
|
|
140
|
+
@value == 'Restarting'
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def updating?
|
|
144
|
+
@value == 'Updating'
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def maintaining?
|
|
148
|
+
@value == 'Maintaining'
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def partially_available?
|
|
152
|
+
@value == 'PartiallyAvailable'
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def not_available?
|
|
156
|
+
@value == 'NotAvailable'
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def terminating?
|
|
160
|
+
@value == 'Terminating'
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def terminated?
|
|
164
|
+
@value == 'Terminated'
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def to_json(*a)
|
|
168
|
+
@value
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def to_s
|
|
172
|
+
@value
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
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 ListForm
|
|
22
|
+
attr_reader :where
|
|
23
|
+
attr_reader :limit
|
|
24
|
+
attr_reader :order_by
|
|
25
|
+
|
|
26
|
+
def initialize(where = nil, limit = nil, order_by = nil)
|
|
27
|
+
@_type = 'ListForm'
|
|
28
|
+
@where = where
|
|
29
|
+
@limit = limit
|
|
30
|
+
@order_by = order_by
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self._type
|
|
34
|
+
'ListForm'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.from_json(js)
|
|
38
|
+
h = JSON.parse(js)
|
|
39
|
+
ListForm.from_hash(h)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def to_remote
|
|
43
|
+
result = {}
|
|
44
|
+
result[:where] = @where unless @where.nil?
|
|
45
|
+
result[:limit] = @limit unless @limit.nil?
|
|
46
|
+
result[:orderBy] = @order_by unless @order_by.nil?
|
|
47
|
+
result
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def to_hash
|
|
51
|
+
result = {}
|
|
52
|
+
result[:where] = @where unless @where.nil?
|
|
53
|
+
result[:limit] = @limit unless @limit.nil?
|
|
54
|
+
result[:order_by] = @order_by unless @order_by.nil?
|
|
55
|
+
result
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.from_remote(h)
|
|
59
|
+
ListForm.new(h['where'].nil? ? h['where'] : nil,
|
|
60
|
+
h['limit'].nil? ? h['limit'] : nil,
|
|
61
|
+
h['orderBy'].nil? ? h['orderBy'] : nil)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def self.from_hash(h)
|
|
65
|
+
ListForm.new(h['where'].nil? ? h['where'] : nil,
|
|
66
|
+
h['limit'].nil? ? h['limit'] : nil,
|
|
67
|
+
h['order_by'].nil? ? h['order_by'] : nil)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def to_json(*a)
|
|
71
|
+
to_hash.to_json(*a)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.empty
|
|
75
|
+
ListForm.new(nil, nil, nil)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def to_query_string
|
|
79
|
+
if @where.nil? && @limit.nil? && @order_by.nil?
|
|
80
|
+
''
|
|
81
|
+
else
|
|
82
|
+
'?' + [
|
|
83
|
+
@where.nil? ? nil : 'where=' + @where,
|
|
84
|
+
@limit.nil? ? nil : 'limit=' + @limit,
|
|
85
|
+
@order_by.nil? ? nil : 'orderBy=' + @order_by].filter(&:nil?).join('&')
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def to_s
|
|
90
|
+
('ListForm(where=' + @where +
|
|
91
|
+
', limit=' + @limit +
|
|
92
|
+
', order_by=' + @order_by + ')')
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
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 Pagination
|
|
22
|
+
attr_reader :self_url
|
|
23
|
+
attr_reader :prev_url
|
|
24
|
+
attr_reader :next_url
|
|
25
|
+
attr_reader :started_time
|
|
26
|
+
attr_reader :nb_items_on_this_page
|
|
27
|
+
attr_reader :page
|
|
28
|
+
attr_reader :nb_items_per_page
|
|
29
|
+
|
|
30
|
+
def initialize(self_url,
|
|
31
|
+
prev_url,
|
|
32
|
+
next_url,
|
|
33
|
+
started_time,
|
|
34
|
+
nb_items_on_this_page,
|
|
35
|
+
page,
|
|
36
|
+
nb_items_per_page)
|
|
37
|
+
@_type = 'Pagination'
|
|
38
|
+
@self_url = self_url
|
|
39
|
+
@prev_url = prev_url
|
|
40
|
+
@next_url = next_url
|
|
41
|
+
@started_time = started_time
|
|
42
|
+
@nb_items_on_this_page = nb_items_on_this_page
|
|
43
|
+
@page = page
|
|
44
|
+
@nb_items_per_page = nb_items_per_page
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self._type
|
|
48
|
+
'Pagination'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def self.from_json(js)
|
|
52
|
+
h = JSON.parse(js)
|
|
53
|
+
Pagination.from_hash(h)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def to_remote
|
|
57
|
+
result = {}
|
|
58
|
+
result[:_type] = @_type
|
|
59
|
+
result[:selfUrl] = @self_url
|
|
60
|
+
result[:prevUrl] = @prev_url unless @prev_url.nil?
|
|
61
|
+
result[:nextUrl] = @next_url unless @next_url.nil?
|
|
62
|
+
result[:startedTime] = @started_time.to_remote
|
|
63
|
+
result[:nbItemsOnThisPage] = @nb_items_on_this_page
|
|
64
|
+
result[:page] = @page
|
|
65
|
+
result[:nbItemsPerPage] = @nb_items_per_page
|
|
66
|
+
result
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def to_hash
|
|
70
|
+
result = {}
|
|
71
|
+
result[:_type] = @_type
|
|
72
|
+
result[:self_url] = @self_url
|
|
73
|
+
result[:prev_url] = @prev_url unless @prev_url.nil?
|
|
74
|
+
result[:next_url] = @next_url unless @next_url.nil?
|
|
75
|
+
result[:started_time] = @started_time.to_hash
|
|
76
|
+
result[:nb_items_on_this_page] = @nb_items_on_this_page
|
|
77
|
+
result[:page] = @page
|
|
78
|
+
result[:nb_items_per_page] = @nb_items_per_page
|
|
79
|
+
result
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.from_remote(h)
|
|
83
|
+
Pagination.new(h['selfUrl'],
|
|
84
|
+
h['prevUrl'].nil? ? h['prevUrl'] : nil,
|
|
85
|
+
h['nextUrl'].nil? ? h['nextUrl'] : nil,
|
|
86
|
+
UTCDateTime.from_remote(h['startedTime']),
|
|
87
|
+
h['nbItemsOnThisPage'],
|
|
88
|
+
h['page'],
|
|
89
|
+
h['nbItemsPerPage'])
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def self.from_hash(h)
|
|
93
|
+
Pagination.new(h['self_url'],
|
|
94
|
+
h['prev_url'].nil? ? h['prev_url'] : nil,
|
|
95
|
+
h['next_url'].nil? ? h['next_url'] : nil,
|
|
96
|
+
UTCDateTime.from_hash(h['started_time']),
|
|
97
|
+
h['nb_items_on_this_page'],
|
|
98
|
+
h['page'],
|
|
99
|
+
h['nb_items_per_page'])
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def to_json(*a)
|
|
103
|
+
to_hash.to_json(*a)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def to_s
|
|
107
|
+
('Pagination(self_url=' + @self_url +
|
|
108
|
+
', prev_url=' + @prev_url +
|
|
109
|
+
', next_url=' + @next_url +
|
|
110
|
+
', started_time=' + @started_time.to_s +
|
|
111
|
+
', nb_items_on_this_page=' + @nb_items_on_this_page +
|
|
112
|
+
', page=' + @page +
|
|
113
|
+
', nb_items_per_page=' + @nb_items_per_page + ')')
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
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 Play
|
|
22
|
+
attr_reader :todo
|
|
23
|
+
|
|
24
|
+
def initialize(todo)
|
|
25
|
+
@_type = 'Play'
|
|
26
|
+
@todo = todo
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self._type
|
|
30
|
+
'Play'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.from_json(js)
|
|
34
|
+
h = JSON.parse(js)
|
|
35
|
+
Play.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
|
+
Play.new(h['todo'])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.from_hash(h)
|
|
57
|
+
Play.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
|
+
'Play(todo=' + @todo + ')'
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
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 Publish
|
|
22
|
+
attr_reader :rtmp
|
|
23
|
+
|
|
24
|
+
def initialize(rtmp)
|
|
25
|
+
@_type = 'Publish'
|
|
26
|
+
@rtmp = rtmp
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self._type
|
|
30
|
+
'Publish'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.from_json(js)
|
|
34
|
+
h = JSON.parse(js)
|
|
35
|
+
Publish.from_hash(h)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def to_remote
|
|
39
|
+
result = {}
|
|
40
|
+
result[:_type] = @_type
|
|
41
|
+
result[:rtmp] = @rtmp.to_remote
|
|
42
|
+
result
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_hash
|
|
46
|
+
result = {}
|
|
47
|
+
result[:_type] = @_type
|
|
48
|
+
result[:rtmp] = @rtmp.to_hash
|
|
49
|
+
result
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.from_remote(h)
|
|
53
|
+
Publish.new(PublishRtmp.from_remote(h['rtmp']))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.from_hash(h)
|
|
57
|
+
Publish.new(PublishRtmp.from_hash(h['rtmp']))
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def to_json(*a)
|
|
61
|
+
to_hash.to_json(*a)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def to_s
|
|
65
|
+
'Publish(rtmp=' + @rtmp.to_s + ')'
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
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 PublishRtmp
|
|
22
|
+
attr_reader :stream_key_prefix
|
|
23
|
+
attr_reader :ip
|
|
24
|
+
attr_reader :domain
|
|
25
|
+
|
|
26
|
+
def initialize(stream_key_prefix, ip, domain)
|
|
27
|
+
@_type = 'PublishRtmp'
|
|
28
|
+
@stream_key_prefix = stream_key_prefix
|
|
29
|
+
@ip = ip
|
|
30
|
+
@domain = domain
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self._type
|
|
34
|
+
'PublishRtmp'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.from_json(js)
|
|
38
|
+
h = JSON.parse(js)
|
|
39
|
+
PublishRtmp.from_hash(h)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def to_remote
|
|
43
|
+
result = {}
|
|
44
|
+
result[:_type] = @_type
|
|
45
|
+
result[:streamKeyPrefix] = @stream_key_prefix
|
|
46
|
+
result[:ip] = @ip.to_remote
|
|
47
|
+
result[:domain] = @domain.to_remote
|
|
48
|
+
result
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def to_hash
|
|
52
|
+
result = {}
|
|
53
|
+
result[:_type] = @_type
|
|
54
|
+
result[:stream_key_prefix] = @stream_key_prefix
|
|
55
|
+
result[:ip] = @ip.to_hash
|
|
56
|
+
result[:domain] = @domain.to_hash
|
|
57
|
+
result
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.from_remote(h)
|
|
61
|
+
PublishRtmp.new(h['streamKeyPrefix'],
|
|
62
|
+
SecureAndNonSecure.from_remote(h['ip']),
|
|
63
|
+
SecureAndNonSecure.from_remote(h['domain']))
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.from_hash(h)
|
|
67
|
+
PublishRtmp.new(h['stream_key_prefix'],
|
|
68
|
+
SecureAndNonSecure.from_hash(h['ip']),
|
|
69
|
+
SecureAndNonSecure.from_hash(h['domain']))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def to_json(*a)
|
|
73
|
+
to_hash.to_json(*a)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def to_s
|
|
77
|
+
('PublishRtmp(stream_key_prefix=' + @stream_key_prefix +
|
|
78
|
+
', ip=' + @ip.to_s +
|
|
79
|
+
', domain=' + @domain.to_s + ')')
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
module Sidemash::SDK
|
|
4
|
+
class StreamSquareRestCollection
|
|
5
|
+
attr_reader :url
|
|
6
|
+
attr_reader :pagination
|
|
7
|
+
attr_reader :items
|
|
8
|
+
|
|
9
|
+
def initialize(url, pagination, items)
|
|
10
|
+
@_type = 'StreamSquareRestCollection'
|
|
11
|
+
@url = url
|
|
12
|
+
@pagination = pagination
|
|
13
|
+
@items = items
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self._type
|
|
17
|
+
'StreamSquareRestCollection'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.from_json(js)
|
|
21
|
+
h = JSON.parse(js)
|
|
22
|
+
StreamSquareRestCollection.from_hash(h)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_remote
|
|
26
|
+
result = {}
|
|
27
|
+
result[:_type] = @_type
|
|
28
|
+
result[:url] = @url
|
|
29
|
+
result[:pagination] = @pagination.to_remote
|
|
30
|
+
result[:items] = @items.map { |el| el.to_remote }
|
|
31
|
+
result
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def to_hash
|
|
35
|
+
result = {}
|
|
36
|
+
result[:_type] = @_type
|
|
37
|
+
result[:url] = @url
|
|
38
|
+
result[:pagination] = @pagination.to_hash
|
|
39
|
+
result[:items] = @items.map { |el| el.to_hash }
|
|
40
|
+
result
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.from_remote(h)
|
|
44
|
+
StreamSquareRestCollection.new(h['url'],
|
|
45
|
+
Pagination.from_remote(h['pagination']),
|
|
46
|
+
h['items'].map { |item_hash| StreamSquare.from_remote(item_hash) })
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.from_hash(h)
|
|
50
|
+
StreamSquareRestCollection.new(h['url'],
|
|
51
|
+
Pagination.from_hash(h['pagination']),
|
|
52
|
+
h['items'].map { |item_hash| StreamSquare.from_hash(item_hash) })
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def to_json(*a)
|
|
56
|
+
to_hash.to_json(*a)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def to_s
|
|
60
|
+
('StreamSquareRestCollection(url=' + @url +
|
|
61
|
+
', pagination=' + @pagination.to_s +
|
|
62
|
+
', items=' + @items.to_s + ')')
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|