class Box::Item
Attributes
client[RW]
metadata[RW]
Public Class Methods
find(id, client = Box.client)
click to toggle source
# File lib/box/item.rb, line 30 def self.find(id, client = Box.client) response = client.get("#{type.pluralize}/#{id}") self.new(client, response.body) rescue Box::ResourceNotFound => e nil end
new(*args)
click to toggle source
# File lib/box/item.rb, line 13 def initialize(*args) if args.size == 1 @client, @metadata = Box.client, Hashie::Mash.new(args[0]) else @client, @metadata = args[0], Hashie::Mash.new(args[1]) end end
type()
click to toggle source
# File lib/box/item.rb, line 9 def self.type self.name.demodulize.downcase end
Public Instance Methods
file?()
click to toggle source
# File lib/box/item.rb, line 26 def file? type == 'file' end
folder?()
click to toggle source
# File lib/box/item.rb, line 22 def folder? type == 'folder' end