Class: Sendly::Media
- Inherits:
-
Object
- Object
- Sendly::Media
- Defined in:
- lib/sendly/media.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Media
constructor
A new instance of Media.
- #upload(file, content_type: "image/jpeg", filename: "upload.jpg") ⇒ Object
Constructor Details
#initialize(client) ⇒ Media
Returns a new instance of Media.
7 8 9 |
# File 'lib/sendly/media.rb', line 7 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/sendly/media.rb', line 5 def client @client end |
Instance Method Details
#upload(file, content_type: "image/jpeg", filename: "upload.jpg") ⇒ Object
11 12 13 14 |
# File 'lib/sendly/media.rb', line 11 def upload(file, content_type: "image/jpeg", filename: "upload.jpg") response = client.post_multipart("/media", file, content_type: content_type, filename: filename) MediaFile.new(response) end |