rubiojr-iorb 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{iorb}
3
- s.version = "0.5.2"
3
+ s.version = "0.5.3"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Sergio RubioSergio Rubio"]
@@ -15,7 +15,7 @@ class Dropio::Asset
15
15
  end
16
16
  end
17
17
  module IORB
18
- VERSION = "0.5.2"
18
+ VERSION = "0.5.3"
19
19
  module Util
20
20
  # Code stolen from:
21
21
  # http://evan.tiggerpalace.com/2008/04/26/pastie-from-the-mac-clipboard/
@@ -79,6 +79,9 @@ module IORB
79
79
  class DropDetails < Hash
80
80
 
81
81
  def method_missing(id, *args)
82
+ if id.eql?(:admin_token) and self[id.to_s.gsub('_', '-')].nil?
83
+ return nil
84
+ end
82
85
  self[id.to_s.gsub('_', '-')] || super
83
86
  end
84
87
 
@@ -1,18 +1,47 @@
1
1
  command :info do |c|
2
2
  c.description = 'display drop/asset info'
3
+ c.syntax = 'iorb info <drop_name>[:asset_name]'
3
4
  c.when_called do |args, options|
4
5
  if args.empty?
5
6
  $stderr.puts 'Needs drop name as an argument.'
7
+ $stderr.puts c.syntax
6
8
  else
7
9
  begin
8
10
  drop_name = args.first
11
+ if drop_name =~ /^\w+:.*/
12
+ drop_name, asset = drop_name.split(':')
13
+ end
9
14
  details = IORB::DropManager.find(drop_name)
10
15
  admin_token = nil
11
- admin_token = details.admin_token if details
12
- drop = Drop.find(args.first, admin_token)
13
- details = IORB::DropDetails.build_from(drop)
14
- details.save
15
- details.print
16
+ if details
17
+ admin_token = details.admin_token
18
+ end
19
+ drop = Drop.find(drop_name, admin_token)
20
+ if asset
21
+ assets = drop.assets
22
+ found = false
23
+ if assets.empty?
24
+ $stderr.puts "No assets in #{drop_name}"
25
+ abort
26
+ else
27
+ drop.assets.each do |a|
28
+ if a.name.eql? asset
29
+ found = true
30
+ puts a.class
31
+ puts "Name: #{a.name}"
32
+ puts "Hidden URL: #{a.hidden_url}"
33
+ puts "Type: #{a.type}"
34
+ puts "File size: #{a.filesize}"
35
+ puts "Created at: #{a.created_at}"
36
+ end
37
+ end
38
+ end
39
+ $stderr.puts "Asset #{asset} not found in #{drop_name}" if not found
40
+ else
41
+ details = IORB::DropDetails.build_from(drop)
42
+ details.save
43
+ details.print
44
+ end
16
45
  rescue Dropio::MissingResourceError
17
46
  $stderr.puts "Drop/Asset does not exist"
18
47
  rescue Dropio::AuthorizationError
@@ -8,7 +8,7 @@ command :update do |c|
8
8
  c.option '--admin-password PASSWORD', String, 'Admin password to manage this drop (defaut: none)'
9
9
  c.option '--password PASSWORD', String, 'Password to access this drop (defaut: none)'
10
10
  c.option '--premium-code CODE', String, 'Premium code to apply to the drop (defaut: none)'
11
- c.syntax = 'Usage: iorb update <drop_name> [options]'
11
+ c.syntax = 'iorb update <drop_name> [options]'
12
12
  c.when_called do |args, drop_options|
13
13
  drop_name = args.first
14
14
  if drop_name.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubiojr-iorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio RubioSergio Rubio