fanforce 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,8 @@
1
+ require_relative 'utils'
2
+
1
3
  class Fanforce
2
4
  class Error < StandardError;
5
+ include ::Fanforce::Utils
3
6
  attr_accessor :path, :query_params, :request, :response, :request_url
4
7
 
5
8
  def initialize(response, request, path, query_params)
@@ -11,20 +14,20 @@ class Fanforce
11
14
  rescue Exception => e
12
15
  @response = "JSON decode error in Gem: #{e.message}"
13
16
  end
14
- @request_url = "#{@path}?#{@query_params.to_param}"
17
+ @request_url = "#{@path}?#{to_param(@query_params)}"
15
18
  super(@response.is_a?(Hash) ? @response[:msg] : @response)
16
19
  end
17
20
 
18
21
  def curl_command
19
22
  case @request.method
20
23
  when :get
21
- "curl \"#{@path}?#{@query_params.to_param}\""
24
+ "curl \"#{@path}?#{to_param(@query_params)}\""
22
25
  when :post
23
- "curl -X POST -d \"#{@query_params.to_param}\" #{@path}"
26
+ "curl -X POST -d \"#{to_param(@query_params)}\" #{@path}"
24
27
  when :put
25
- "curl -X PUT -d \"#{@query_params.to_param}\" #{@path.to_json}"
28
+ "curl -X PUT -d \"#{to_param(@query_params)}\" #{@path.to_json}"
26
29
  when :delete
27
- "curl --request DELETE \"#{@path}?#{@query_params.to_param}\""
30
+ "curl --request DELETE \"#{@path}?#{to_param(@query_params)}\""
28
31
  else
29
32
  "Could not create curl command because request method was unknown: #{@request.method}"
30
33
  end
@@ -1,3 +1,3 @@
1
1
  class Fanforce
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: