Class: IORB::DropDetails
- Inherits:
-
Hash
- Object
- Hash
- IORB::DropDetails
- Defined in:
- lib/iorb.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build_from(drop) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/iorb.rb', line 67 def self.build_from(drop) details = DropDetails.new if drop.is_a? Dropio::Drop details['name'] = drop.name details['email'] = drop.email details['admin-url'] = drop.generate_url details['admin-token'] = drop.admin_token details['public-url'] = "http://drop.io/#{drop.name}" details['hidden-uploads'] = drop.hidden_upload_url details['max-bytes'] = drop.max_bytes else details['name'] = drop['name'] details['email'] = drop['email'] details['admin-url'] = drop['admin-url'] details['admin-token'] = drop['admin-token'] details['public-url'] = "http://drop.io/#{drop['name']}" details['hidden-uploads'] = drop['hidden-uploads'] details['max-bytes'] = drop['max-bytes'] end details end |
Instance Method Details
#print ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/iorb.rb', line 89 def print puts "Name: #{self['name']}" puts "Drop Email: #{self['email']}" puts "URL: http://drop.io/#{self['name']}" puts "Max Bytes: #{self['max-bytes']}" puts "Admin Token: #{self['admin-token']}" puts "Hidden Upload URL: #{self['hidden-uploads']}" # Get the admin URL puts "Admin URL: #{self['admin-url']}" end |
#save ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/iorb.rb', line 100 def save config = YAML.load_file(IORB::Config.file) config['mydrops'] = {} if config['mydrops'].nil? config['mydrops'][self['name']] = {}.merge(self) File.open(IORB::Config.file, 'w') do |f| f.puts config.to_yaml end end |