@@ -14,14 +14,14 @@ module Teletube
14
14
if token.empty?
15
15
context.errors << " Please specify an access token."
16
16
else
17
- context.params[" token" ] = token
17
+ context.params[" token" ] = JSON :: Any .new( token)
18
18
end
19
19
end
20
20
parser.on(" --endpoint ENDPOINT" , " Base endpoint to use to contact the web service" ) do |endpoint |
21
21
if endpoint.empty?
22
22
context.errors << " Please specify and endpoint."
23
23
else
24
- context.params[" endpoint" ] = endpoint
24
+ context.params[" endpoint" ] = JSON :: Any .new( endpoint)
25
25
end
26
26
end
27
27
end
@@ -40,37 +40,74 @@ module Teletube
40
40
context.command = " list"
41
41
parser.on(" --role ROLE" , " The role of the authenticated profile." ) do |role |
42
42
if %w[owner contributor] .includes?(role)
43
- context.params[" role" ] = role
43
+ context.params[" role" ] = JSON :: Any .new( role)
44
44
else
45
45
context.errors << " Please specify either owner or contributor for the role."
46
46
end
47
47
end
48
48
end
49
+ channel_params = - > {
50
+ parser.on(" --name NAME" , " Channel name." ) do |name |
51
+ context.params[" name" ] = JSON ::Any .new(name)
52
+ end
53
+ parser.on(" --description DESCRIPTION" , " Channel description." ) do |description |
54
+ context.params[" description" ] = JSON ::Any .new(description)
55
+ end
56
+ parser.on(" --category CATEGORY" , " Channel category." ) do |category |
57
+ context.params[" category" ] = JSON ::Any .new(category)
58
+ end
59
+ parser.on(" --language LANGUAGE" , " Channel language." ) do |language |
60
+ context.params[" language" ] = JSON ::Any .new(language)
61
+ end
62
+ parser.on(" --viewable-by VIEWABLE_BY" , " Choose: all, all-hidden, authenticated, organization, or collaborators." ) do |viewable_by |
63
+ context.params[" viewable_by" ] = JSON ::Any .new(viewable_by)
64
+ end
65
+ parser.on(" --open-channel" , " Mark channel as Open Channel." ) do
66
+ context.params[" open_channel" ] = JSON ::Any .new(true )
67
+ end
68
+ parser.on(" --commentable" , " Turn on comments." ) do
69
+ context.params[" commentable" ] = JSON ::Any .new(true )
70
+ end
71
+ parser.on(" --downloadable" , " Allow video downloads." ) do
72
+ context.params[" downloadable" ] = JSON ::Any .new(true )
73
+ end
74
+ parser.on(" --archive" , " The uploaded video files will be archived." ) do
75
+ context.params[" archive_original_video_files" ] = JSON ::Any .new(true )
76
+ end
77
+ parser.on(" --external-playback" , " Allow external playback." ) do
78
+ context.params[" external_playback" ] = JSON ::Any .new(true )
79
+ end
80
+ parser.on(" --hide-owner" , " Name of the channel owner will not be shown." ) do
81
+ context.params[" hide_owner" ] = JSON ::Any .new(true )
82
+ end
83
+ parser.on(" --podcast" , " All uploaded files will be processed as a podcast and viewers will be able to subscribe to a feed." ) do
84
+ context.params[" podcast" ] = JSON ::Any .new(true )
85
+ end
86
+ parser.on(" --explicit" , " Contains media only suited for mature audiences." ) do
87
+ context.params[" explicit" ] = JSON ::Any .new(true )
88
+ end
89
+ }
49
90
parser.on(" create" , " Create a new channel." ) do
50
91
context.command = " create"
51
- parser.on(" --name NAME" , " The name of the channel." ) do |name |
52
- context.params[" name" ] = name
53
- end
92
+ channel_params.call
54
93
end
55
94
parser.on(" show" , " Show details about a channel." ) do
56
95
context.command = " show"
57
96
parser.on(" --id ID" , " The identifier of the channel to show." ) do |id |
58
- context.params[" id" ] = id
97
+ context.params[" id" ] = JSON :: Any .new(id)
59
98
end
60
99
end
61
100
parser.on(" update" , " Update details for a channel." ) do
62
101
context.command = " update"
63
102
parser.on(" --id ID" , " The identifier of the channel to update." ) do |id |
64
- context.params[" id" ] = id
65
- end
66
- parser.on(" --name NAME" , " The name of the channel." ) do |name |
67
- context.params[" name" ] = name
103
+ context.params[" id" ] = JSON ::Any .new(id)
68
104
end
105
+ channel_params.call
69
106
end
70
107
parser.on(" destroy" , " Destroy a channel." ) do
71
108
context.command = " destroy"
72
109
parser.on(" --id ID" , " The identifier of the channel to destroy." ) do |id |
73
- context.params[" id" ] = id
110
+ context.params[" id" ] = JSON :: Any .new(id)
74
111
end
75
112
end
76
113
end
@@ -80,13 +117,13 @@ module Teletube
80
117
parser.on(" create" , " Create a new upload." ) do
81
118
context.command = " create"
82
119
parser.on(" --channel-id ID" , " The id of the channel that will contain the video." ) do |channel_id |
83
- context.params[" channel_id" ] = channel_id
120
+ context.params[" channel_id" ] = JSON :: Any .new( channel_id)
84
121
end
85
122
end
86
123
parser.on(" perform" , " Create a new upload, perform the upload, and create a video." ) do
87
124
context.command = " perform"
88
125
parser.on(" --channel-id ID" , " The id of the channel that will contain the video." ) do |channel_id |
89
- context.params[" channel_id" ] = channel_id
126
+ context.params[" channel_id" ] = JSON :: Any .new( channel_id)
90
127
end
91
128
end
92
129
end
0 commit comments