Method: CloudFS::Item#initialize

Defined in:
lib/cloudfs/item.rb

#initialize(rest_adapter, parent: nil, parent_state: nil, in_trash: false, in_share: false, old_version: false, **properties) ⇒ Item

Returns a new instance of Item.

Parameters:

  • rest_adapter (RestAdapter)

    RESTful Client instance

  • parent (Item, String) (defaults to: nil)

    default: ("/") parent folder item or url

  • in_trash (Boolean) (defaults to: false)

    set true to specify item exists in trash

  • in_share (Boolean) (defaults to: false)

    set true to specify item exists in share

  • old_version (Boolean) (defaults to: false)

    set true to specify item is an old version

  • properties (Hash)

    metadata of item @option properties [String] :id path id of item @option properties [String] :parent_id (nil) pathid of parent of item @option properties [String] :type (nil) type of item either file, folder @option properties [String] :name (nil) @option properties [Timestamp] :date_created (nil) @option properties [Timestamp] :date_meta_last_modified (nil) @option properties [Timestamp] :date_content_last_modified (nil) @option properties [Fixnum] :version (nil) @option properties [Boolean] :is_mirrored (nil) @option properties [String] :mime (nil) applicable to item type file only @option properties [String] :blocklist_key (nil) applicable to item type file only @option properties [String] :blocklist_id (nil) applicable to item type file only @option properties [Fixnum] :size (nil) applicable to item of type file only @option properties [Hash] :application_data ({}) extra metadata of item

  • parent_state (Hash) (defaults to: nil)

    a customizable set of options

Options Hash (parent_state:):

  • parent_state (Hash)

    the parent state of the item

Raises:



143
144
145
146
147
148
149
150
151
# File 'lib/cloudfs/item.rb', line 143

def initialize(rest_adapter, parent: nil, parent_state: nil, in_trash: false,
               in_share: false, old_version: false, ** properties)
  fail RestAdapter::Errors::ArgumentError,
       'Invalid RestAdapter, input type must be CloudFS::RestAdapter' unless rest_adapter.is_a?(RestAdapter)

  @rest_adapter = rest_adapter
  set_item_properties(parent: parent, parent_state: parent_state, in_trash: in_trash,
                      in_share: in_share, old_version: old_version, ** properties)
end