Class: OVH::REST
- Inherits:
-
Object
- Object
- OVH::REST
- Defined in:
- lib/ovh/rest.rb
Constant Summary collapse
- API_URL =
"https://api.ovh.com/1.0"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_key, api_secret, consumer_key) ⇒ REST
constructor
A new instance of REST.
Constructor Details
Class Method Details
.generate_consumer_key(api_key, access_rules) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/ovh/rest.rb', line 15 def generate_consumer_key(api_key, access_rules) uri = URI.parse("#{API_URL}/auth/credential") request = Net::HTTP::Post.new(uri.path, initheader = {"X-Ovh-Application" => api_key, "Content-type" => "application/json"}) request.body = access_rules.to_json http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true response = http.request(request) JSON.parse(response.body) end |