instamsg-ruby 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -98,13 +98,18 @@ module Instamsg
98
98
  http = @client.http_sync_client
99
99
  http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
100
100
  begin
101
- File.open(@params["file"]) do |file|
102
- @body = { :file => file}
103
- response = http.request(@verb, @uri, @params, @body, @head)
101
+ file = @params["file"] || @params[:file]
102
+ if file.present?
103
+ File.open(@params["file"]) do |file|
104
+ @body = { :file => file}
105
+ response = http.request(@verb, @uri, @params, @body, @head)
104
106
 
105
- body = response.body ? response.body.chomp : nil
106
- return handle_response(response.code.to_i, body)
107
- end
107
+ body = response.body ? response.body.chomp : nil
108
+ return handle_response(response.code.to_i, body)
109
+ end
110
+ else
111
+ return handle_response("500", "You have not passed file object.)
112
+ end
108
113
  rescue HTTPClient::BadResponseError, HTTPClient::TimeoutError,
109
114
  SocketError, HTTPClient::ReceiveTimeoutError, Errno::ECONNREFUSED => e
110
115
  error = Instamsg::HTTPError.new("#{e.message} (#{e.class})")
@@ -1,3 +1,3 @@
1
1
  module Instamsg
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instamsg-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Instamsg
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2015-04-02 00:00:00 Z
18
+ date: 2015-04-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: httpclient