Class: WpRpc::Attachment
Instance Attribute Summary collapse
-
#file ⇒ Object
writeonly
Sets the attribute file.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#mimetype ⇒ Object
Returns the value of attribute mimetype.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(attributes, options = { }) ⇒ Attachment
constructor
A new instance of Attachment.
- #save ⇒ Object
Methods inherited from Base
#change_attributes, #conn, #pattern
Constructor Details
#initialize(attributes, options = { }) ⇒ Attachment
Returns a new instance of Attachment.
6 7 8 9 10 11 12 |
# File 'lib/wp_rpc/attachment.rb', line 6 def initialize(attributes, = { }) super() self.name = attributes[:name] self.filename = attributes[:filename] self.mimetype = attributes[:mimetype] self.file = attributes[:file] end |
Instance Attribute Details
#file=(value) ⇒ Object
Sets the attribute file
4 5 6 |
# File 'lib/wp_rpc/attachment.rb', line 4 def file=(value) @file = value end |
#filename ⇒ Object
Returns the value of attribute filename.
4 5 6 |
# File 'lib/wp_rpc/attachment.rb', line 4 def filename @filename end |
#mimetype ⇒ Object
Returns the value of attribute mimetype.
4 5 6 |
# File 'lib/wp_rpc/attachment.rb', line 4 def mimetype @mimetype end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/wp_rpc/attachment.rb', line 4 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/wp_rpc/attachment.rb', line 4 def url @url end |
Instance Method Details
#save ⇒ Object
14 15 16 17 18 |
# File 'lib/wp_rpc/attachment.rb', line 14 def save ret = conn.upload_file(name, mimetype, bits) self.url = ret["url"] self end |