Class: Bkblz::V1::ListFileVersionsRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/bkblz/v1/list_file_versions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Request

response_class, #send, url_suffix

Constructor Details

#initialize(bucket, max_file_count = 1000, paginate_from = nil) ⇒ ListFileVersionsRequest

Returns a new instance of ListFileVersionsRequest.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bkblz/v1/list_file_versions.rb', line 21

def initialize(bucket, max_file_count=1000, paginate_from=nil)
  @bucket = bucket
  @body = {}
  @body[:bucket_id] = bucket.bucket_id
  @body[:max_file_count] = max_file_count

  if paginate_from
    raise 'invalid paginator' unless paginate_from.is_a? ListFileVersionsResponse

    next_file_name = paginate_from.next_file_name
    next_file_id = paginate_from.next_file_id

    @body[:start_file_name] = next_file_name if next_file_name
    @body[:start_file_id] = next_file_id if next_file_id
  end
end

Instance Attribute Details

#bucketObject (readonly)

Returns the value of attribute bucket.



19
20
21
# File 'lib/bkblz/v1/list_file_versions.rb', line 19

def bucket
  @bucket
end

Instance Method Details

#build_request(session) ⇒ Object



38
39
40
# File 'lib/bkblz/v1/list_file_versions.rb', line 38

def build_request(session)
  session.create_post url(session), @body
end