Class: Scaleway::CallHandler
- Inherits:
-
Object
- Object
- Scaleway::CallHandler
- Defined in:
- lib/scaleway-api/scaleway.rb
Instance Method Summary collapse
- #create(opts) ⇒ Object
- #delete(key) ⇒ Object
- #get(key) ⇒ Object
-
#initialize(opts, res_name) ⇒ CallHandler
constructor
A new instance of CallHandler.
- #list ⇒ Object
- #update(key, opts) ⇒ Object
Constructor Details
#initialize(opts, res_name) ⇒ CallHandler
Returns a new instance of CallHandler.
18 19 20 21 |
# File 'lib/scaleway-api/scaleway.rb', line 18 def initialize(opts, res_name) @token = opts[:token] @uri = "https://cp-#{opts[:region]}.scaleway.com/#{res_name}" end |
Instance Method Details
#create(opts) ⇒ Object
32 33 34 35 36 |
# File 'lib/scaleway-api/scaleway.rb', line 32 def create(opts) req = Net::HTTP::Post.new(URI(@uri)) req.body = opts.to_json send_request req end |
#delete(key) ⇒ Object
45 46 47 48 |
# File 'lib/scaleway-api/scaleway.rb', line 45 def delete(key) @uri += "/#{key}" send_request Net::HTTP::Delete.new(URI(@uri)) end |
#get(key) ⇒ Object
27 28 29 30 |
# File 'lib/scaleway-api/scaleway.rb', line 27 def get(key) @uri += "/#{key}" send_request Net::HTTP::Get.new(URI(@uri)) end |
#list ⇒ Object
23 24 25 |
# File 'lib/scaleway-api/scaleway.rb', line 23 def list send_request Net::HTTP::Get.new(URI(@uri)) end |
#update(key, opts) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/scaleway-api/scaleway.rb', line 38 def update(key, opts) @uri += "/#{key}" req = Net::HTTP::Put.new(URI(@uri)) req.body = opts.to_json send_request req end |