Class: EmailDirect::ImageFolder

Inherits:
Object
  • Object
show all
Defined in:
lib/emaildirect/image_folder.rb

Overview

Represents a image folder and associated functionality

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(folder_path) ⇒ ImageFolder

Returns a new instance of ImageFolder.



27
28
29
# File 'lib/emaildirect/image_folder.rb', line 27

def initialize(folder_path)
  @folder_path = folder_path
end

Instance Attribute Details

#folder_pathObject (readonly)

Returns the value of attribute folder_path.



25
26
27
# File 'lib/emaildirect/image_folder.rb', line 25

def folder_path
  @folder_path
end

Class Method Details

.all(options = {}) ⇒ Object



8
9
10
11
# File 'lib/emaildirect/image_folder.rb', line 8

def all(options = {})
  response = EmailDirect.get uri, :query => options
  Hashie::Mash.new(response)
end

.create(name, folder_path = nil) ⇒ Object



13
14
15
16
17
18
# File 'lib/emaildirect/image_folder.rb', line 13

def create(name, folder_path = nil)
  options = { :body => name.to_json }
  options[:query] = { :Folder => folder_path } if folder_path
  response = EmailDirect.post uri, options
  Hashie::Mash.new(response)
end

.uriObject



20
21
22
# File 'lib/emaildirect/image_folder.rb', line 20

def uri
  '/ImageLibrary/Folders'
end

Instance Method Details

#deleteObject



41
42
43
44
# File 'lib/emaildirect/image_folder.rb', line 41

def delete
  response = EmailDirect.delete self.class.uri, query
  Hashie::Mash.new(response)
end

#detailsObject



31
32
33
34
# File 'lib/emaildirect/image_folder.rb', line 31

def details
  response = EmailDirect.get self.class.uri, query
  Hashie::Mash.new(response)
end

#filesObject



36
37
38
39
# File 'lib/emaildirect/image_folder.rb', line 36

def files
  response = EmailDirect.get '/ImageLibrary/Files', query
  Hashie::Mash.new(response)
end