class Scene7::Folder

Attributes

attributes[R]

Public Class Methods

all() click to toggle source
# File lib/scene7/folder.rb, line 6
def all
  response = Client.perform_request(:get_folders, :company_handle => Client.company_handle) 

  folder_hashes = response.to_hash[:get_folders_return][:folder_array][:items]

  folder_hashes.map { |folder_hash| self.new(folder_hash) }
end
create(params) click to toggle source
# File lib/scene7/folder.rb, line 18
def create(params)
  raise ":folder_path is required to create a folder" unless params[:folder_path]

  base_request_params = {:company_handle => Client.company_handle, :order! => [:company_handle, :folder_path]}
  full_request_params = base_request_params.merge(params)

  response   = Client.perform_request(:create_folder, full_request_params)
  attributes = response.to_hash[:create_folder_return]

  new(attributes)
end
find_by_handle(handle) click to toggle source
# File lib/scene7/folder.rb, line 14
def find_by_handle(handle)
  all.detect { |folder| folder.handle == handle } 
end
new(attributes) click to toggle source
# File lib/scene7/folder.rb, line 32
def initialize(attributes)
  @attributes = attributes
end

Public Instance Methods

destroy() click to toggle source
# File lib/scene7/folder.rb, line 36
def destroy
  response = Client.perform_request(:delete_folder, :company_handle => Client.company_handle, :folder_handle => self.handle, :order! => [:company_handle, :folder_handle])

  return response.http.code == 200
end
handle() click to toggle source

folderHandle

# File lib/scene7/folder.rb, line 43
def handle
  attributes[:folder_handle]
end
has_subfolders() click to toggle source
# File lib/scene7/folder.rb, line 55
def has_subfolders
  attributes[:has_subfolders]
end
last_modified() click to toggle source
# File lib/scene7/folder.rb, line 51
def last_modified
  attributes[:last_modified]
end
path() click to toggle source
# File lib/scene7/folder.rb, line 47
def path
  attributes[:path]
end