Module: Rubypress::Media

Included in:
Client
Defined in:
lib/rubypress/media.rb

Instance Method Summary collapse

Instance Method Details

#getMediaItem(options = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/rubypress/media.rb', line 5

def getMediaItem(options = {})
  default_options = {
    :attachment_id => nil
  }.deep_merge!(options)
  execute('getMediaItem', default_options)
end

#getMediaLibrary(options = {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/rubypress/media.rb', line 12

def getMediaLibrary(options = {})
  default_options = {
    :filter => {}
  }.deep_merge!(options)
  execute('getMediaLibrary', default_options)
end

#uploadFile(options = {}) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/rubypress/media.rb', line 19

def uploadFile(options = {})
  default_options = {
    :data => {}
  }.deep_merge!(options)
  default_options[:data][:bits] = XMLRPC::Base64.new(File.read(default_options.delete(:filename))) if options.include?(:filename) and File.readable?(options[:filename])
  execute('uploadFile', default_options)
end