Class: SonyCiAdmin::Lister
Overview
Instance Method Summary
collapse
#add_headers, #handle_errors
Constructor Details
#initialize(ci) ⇒ Lister
86
87
88
|
# File 'lib/sony_ci_api/sony_ci_admin.rb', line 86
def initialize(ci)
@ci = ci
end
|
Instance Method Details
#each ⇒ Object
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/sony_ci_api/sony_ci_admin.rb', line 99
def each
limit = 5
offset = 0
loop do
assets = list(limit, offset)
break if assets.empty?
assets.each { |asset| yield asset }
offset += limit
end
end
|
#list(limit, offset) ⇒ Object
90
91
92
93
94
95
96
97
|
# File 'lib/sony_ci_api/sony_ci_admin.rb', line 90
def list(limit, offset)
curl = Curl::Easy.http_get('https:''//api.cimediacloud.com/workspaces/' \
"#{@ci.workspace_id}/contents?limit=#{limit}&offset=#{offset}") do |c|
(c)
end
handle_errors(curl)
JSON.parse(curl.body_str)['items']
end
|