ovh-api 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e933d314a1697da8e6d10453aac95a8ffa1190fc
4
- data.tar.gz: 3ca3fdc93e82ecc7b65767619212acf1b8067b00
3
+ metadata.gz: 04ca798d8a38c49b5cbcf1380d2bc712454a7cc9
4
+ data.tar.gz: c8fa15c43882f9f4ed35e6ac484b6ba1b9856702
5
5
  SHA512:
6
- metadata.gz: 47356d383cd69a81c26971a86e05587f7f052fcd1c4cca53a889cbe900574e648410acbfb46b63ae88f3f089eef45a90ba11c4db61078ef728737afa7c4117f8
7
- data.tar.gz: aed83ad2769f62bee3fe0eb99275b16c6ee7aebd0cbb74ede55fe968c219fc74f4bb9c8a67cda22517e53ee4e670c962984eabca8c274591a3fc48a473db665b
6
+ metadata.gz: bf6dd0bf81d316421b4941d436b7f9a5c1ef28548109f6948b91b884283f53e38a40cf276f77f17650d2751a77862ebe42002a15a05d65860e95e91bb5d5e0a0
7
+ data.tar.gz: c83ad30e5c659832da8e9c575269bb8bcdd723dba5e047c373d664e9d2a9b14e1335e7520d50a0462ab74de5f18d5ad7c4e240e85d4b794758d9620c1bd4e236
@@ -73,13 +73,21 @@ module OVHApi
73
73
  # This function raise OVHApiNotImplementedError if method is not valid
74
74
  #
75
75
  # @param method [Symbol]: :get, :post, :put, :delete
76
- # @param url [String]
76
+ # @param path [String]
77
+ # @param arguments: [Hash]: will be encoded to be URL friendly with URI.encode_www_form and then pass as URL parameters
78
+ # @param body [String]: function parameters to be JSONified and sent as body in the request
77
79
  # @return [Hash] { :resp => [Net::HTTPResponse] response, :body => [Hash|NilClass] (:resp body JSON parsed) }
78
- def request_json(method, url)
80
+ def request_json(method, path, arguments = nil, body = '')
79
81
  raise OVHApiNotImplementedError.new(
80
82
  "#{method.to_s} is not implemented. Please refere to documentation."
81
83
  ) unless [:get, :post, :delete, :put].include?method
82
- resp = self.public_send(method, url)
84
+ method_str = method.to_s.upcase
85
+ if arguments.nil? then
86
+ url = path
87
+ else
88
+ url = "#{path}?#{URI.encode_www_form(arguments)}"
89
+ end
90
+ resp = request(url, method_str, body)
83
91
  body = nil
84
92
  begin
85
93
  body = JSON.parse(resp.body)
@@ -1,3 +1,3 @@
1
1
  module OVHApi
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ovh-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roland Laurès