bkblz 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c2440a3e12c3022fbc44a05079430bc77c80a56
4
- data.tar.gz: 667e2e0a9a71e6ceaf81aec43eca2f6e1f9c2d51
3
+ metadata.gz: 990022a090baa3a510ff31ed662426b951a73245
4
+ data.tar.gz: 531dfaecf56ea2a1c886352d4725a0e9558c4c06
5
5
  SHA512:
6
- metadata.gz: 0b2c6b5912e130d96ffab0390e098fd0b35e197f30240a856b21fca701cbe56396d7ecd5bb04fd9e5587725c430322e5f04e867acee8e578a02bcd5a9aae0652
7
- data.tar.gz: ea2b13a18d20c29bb5929969137dede83e20782f5ecbe38b791d16c3ea0205576f9b2c5ee53b5fcfb92036a4f11a5f015cbeb3632389db59cf2da740dd189aaf
6
+ metadata.gz: e1244c37357c5fa5c0c183efedb218683c854002b60f6b4abb976f3b9c033c1f189ff0bbf30d4216189a5678ccc55cb05af4abac6d1bf827fc0c2646eb5c9160
7
+ data.tar.gz: bf64f19457e1d9b21b12298b7c4756b540b812964fadca488639410aa5f8f3749a6acb1d236476f350f69e3864df7fdcd32694d0d562877239821d4b64a2bf1a
data/bin/bkblz CHANGED
@@ -92,13 +92,14 @@ module Bkblz
92
92
  end
93
93
 
94
94
  desc "file list <bucket_name>", "lists files in a bucket"
95
- option :start_at, :desc => "file name to start listing from"
95
+ option :start_at, :desc => "file name to start listing from, cannot be used with --all"
96
96
  option :limit, {
97
97
  :desc => "limit of files to list per request",
98
98
  :default => 100,
99
99
  :type => :numeric
100
100
  }
101
101
  option :all, :desc => "lists all file versions, cannot be used with --start-at"
102
+ option :with_id, :type => :boolean, :desc => "include file_id in results"
102
103
  def list(bucket_name)
103
104
  parse_opts
104
105
 
@@ -112,11 +113,30 @@ module Bkblz
112
113
  :bucket_name => bucket_name
113
114
  })
114
115
 
115
- print_header "Files"
116
- paged_response.files.each do |f|
117
- puts f.file_name
116
+ file_printer = lambda do |file|
117
+ puts options[:with_id] ?
118
+ "%s - %s" % [file.file_name, file.file_id] :
119
+ file.file_name
118
120
  end
121
+
122
+ print_header "Files"
123
+ paged_response.files.each &file_printer
124
+ end
125
+ end
126
+
127
+ desc "file info <id>", "displays info for file with <id>"
128
+ option :id, :desc => "the file id as returned by <file list>"
129
+ def info(file_id)
130
+ parse_opts
131
+
132
+ file_info = run_task do
133
+ Bkblz::Task::GetFileInfo.run Bkblz.config, {
134
+ :file_id => options[:id]
135
+ }
119
136
  end
137
+
138
+ print_header "File Info"
139
+ print_model file_info
120
140
  end
121
141
  end
122
142
 
@@ -1,7 +1,8 @@
1
1
  require_relative "task_helpers"
2
2
  require_relative "task"
3
3
 
4
- require_relative "list_buckets"
5
4
  require_relative "create_bucket"
5
+ require_relative "get_file_info"
6
+ require_relative "list_buckets"
6
7
  require_relative "list_files"
7
8
  require_relative "upload_file"
@@ -0,0 +1,14 @@
1
+ module Bkblz
2
+ module Task
3
+ class GetFileInfo < BaseTask
4
+
5
+ task_param :file_id, :required => true
6
+
7
+ def run_internal(session, params)
8
+ session.send(Bkblz::V1::GetFileInfoRequest.new(params[:file_id]))
9
+ .to_model
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -10,6 +10,7 @@ require_relative "authorize_account"
10
10
  require_relative "list_buckets"
11
11
  require_relative "create_bucket"
12
12
  require_relative "delete_bucket"
13
+ require_relative "get_file_info"
13
14
  require_relative "get_upload_url"
14
15
  require_relative "upload_file"
15
16
  require_relative "list_file_names"
@@ -0,0 +1,22 @@
1
+ module Bkblz
2
+ module V1
3
+
4
+ class GetFileInfoResponse < Response
5
+ response_model Model::FileInfo
6
+ end
7
+
8
+ class GetFileInfoRequest < Request
9
+
10
+ response_class GetFileInfoResponse
11
+ url_suffix "/b2api/v1/b2_get_file_info"
12
+
13
+ def initialize(file_id)
14
+ @file_id = file_id
15
+ end
16
+
17
+ def build_request(session)
18
+ session.create_post url(session), :file_id => @file_id
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module Bkblz
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bkblz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erick Johnson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-07 00:00:00.000000000 Z
11
+ date: 2017-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -91,6 +91,7 @@ files:
91
91
  - lib/bkblz/map_key_formatter.rb
92
92
  - lib/bkblz/task/all.rb
93
93
  - lib/bkblz/task/create_bucket.rb
94
+ - lib/bkblz/task/get_file_info.rb
94
95
  - lib/bkblz/task/list_buckets.rb
95
96
  - lib/bkblz/task/list_files.rb
96
97
  - lib/bkblz/task/task.rb
@@ -103,6 +104,7 @@ files:
103
104
  - lib/bkblz/v1/delete_file_version.rb
104
105
  - lib/bkblz/v1/download_file.rb
105
106
  - lib/bkblz/v1/error_response.rb
107
+ - lib/bkblz/v1/get_file_info.rb
106
108
  - lib/bkblz/v1/get_upload_url.rb
107
109
  - lib/bkblz/v1/list_buckets.rb
108
110
  - lib/bkblz/v1/list_file_names.rb
@@ -134,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
136
  version: '0'
135
137
  requirements: []
136
138
  rubyforge_project:
137
- rubygems_version: 2.5.1
139
+ rubygems_version: 2.5.2
138
140
  signing_key:
139
141
  specification_version: 4
140
142
  summary: Bkblz GEM for the Backblaze B2 API. https://www.backblaze.com/b2/docs/