Method: B2#file
- Defined in:
- lib/b2.rb
#file(bucket, key) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/b2.rb', line 39 def file(bucket, key) bucket_id = @connection.lookup_bucket_id(bucket) file = @connection.post('/b2api/v2/b2_list_file_names', { bucketId: bucket_id, startFileName: key })['files'].find {|f| f['fileName'] == key } file ? B2::File.new(file.merge({'bucketId' => bucket_id}), @connection) : nil end |