Class: EmailDirect::ImageFile
- Inherits:
-
Object
- Object
- EmailDirect::ImageFile
- Defined in:
- lib/emaildirect/image_file.rb
Overview
Represents a image file and associated functionality
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Class Method Summary collapse
- .create_from_file(file_name, local_path, options = {}) ⇒ Object
- .create_from_url(url, options = {}) ⇒ Object
- .uri ⇒ Object
Instance Method Summary collapse
- #delete ⇒ Object
- #details ⇒ Object
-
#initialize(file_path) ⇒ ImageFile
constructor
A new instance of ImageFile.
Constructor Details
#initialize(file_path) ⇒ ImageFile
Returns a new instance of ImageFile.
26 27 28 |
# File 'lib/emaildirect/image_file.rb', line 26 def initialize(file_path) @file_path = file_path end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
24 25 26 |
# File 'lib/emaildirect/image_file.rb', line 24 def file_path @file_path end |
Class Method Details
.create_from_file(file_name, local_path, options = {}) ⇒ Object
14 15 16 17 |
# File 'lib/emaildirect/image_file.rb', line 14 def create_from_file(file_name, local_path, = {}) .merge! :FileName => file_name EmailDirect.post '/ImageUpload', :query => , :body => File.read(local_path) end |
.create_from_url(url, options = {}) ⇒ Object
8 9 10 11 12 |
# File 'lib/emaildirect/image_file.rb', line 8 def create_from_url(url, = {}) .merge! :URL => url response = EmailDirect.post uri, :body => .to_json Hashie::Mash.new(response) end |
.uri ⇒ Object
19 20 21 |
# File 'lib/emaildirect/image_file.rb', line 19 def uri '/ImageLibrary' end |
Instance Method Details
#delete ⇒ Object
35 36 37 |
# File 'lib/emaildirect/image_file.rb', line 35 def delete EmailDirect.delete self.class.uri, query end |
#details ⇒ Object
30 31 32 33 |
# File 'lib/emaildirect/image_file.rb', line 30 def details response = EmailDirect.get self.class.uri, query Hashie::Mash.new(response) end |