Module: Wxapi::Attach

Included in:
Wxapi
Defined in:
lib/wxapi/attach.rb

Instance Method Summary collapse

Instance Method Details

#upload_temp_image(file_path, type = 'image') ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/wxapi/attach.rb', line 3

def upload_temp_image(file_path,type='image')
  access_token = get_access_token
  response = RestClient.post("#{prefix}/cgi-bin/media/upload",
                             {
                                 access_token: access_token,
                                 type: type,
                                 media: File.new(file_path, 'rb')})
  JSON.parse(response)
end