Class: Nifcloud::Request
- Inherits:
-
Object
- Object
- Nifcloud::Request
- Defined in:
- lib/nifcloud/request.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access_key ⇒ Object
Returns the value of attribute access_key.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
Class Method Summary collapse
Instance Method Summary collapse
- #delete(path, options = {}) ⇒ Object
- #get(path, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Request
constructor
A new instance of Request.
- #post(path, options = {}) ⇒ Object
- #put(path, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Request
Returns a new instance of Request.
8 9 10 11 |
# File 'lib/nifcloud/request.rb', line 8 def initialize(={}) @client = HTTPClient.new default_header: {"User-Agent" => @user_agent} @client.debug_dev = $stderr if @debug end |
Instance Attribute Details
#access_key ⇒ Object
Returns the value of attribute access_key.
6 7 8 |
# File 'lib/nifcloud/request.rb', line 6 def access_key @access_key end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/nifcloud/request.rb', line 6 def endpoint @endpoint end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
6 7 8 |
# File 'lib/nifcloud/request.rb', line 6 def secret_key @secret_key end |
Class Method Details
.set_proxy_config(address = nil, port = nil, username = nil, password = nil) ⇒ Object
33 34 35 36 |
# File 'lib/nifcloud/request.rb', line 33 def self.set_proxy_config(address=nil, port=nil, username=nil, password=nil) @client.proxy = "http://#{address}:#{port}" @client.set_proxy_auth(username, password) if username end |
Instance Method Details
#delete(path, options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/nifcloud/request.rb', line 28 def delete(path, ={}) set_query() validate @client.delete(@endpoint + path, ) end |
#get(path, options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/nifcloud/request.rb', line 13 def get(path, ={}) set_query() validate @client.get(@endpoint + path, ) end |
#post(path, options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/nifcloud/request.rb', line 18 def post(path, ={}) set_query() validate @client.post(@endpoint + path, ) end |
#put(path, options = {}) ⇒ Object
23 24 25 26 |
# File 'lib/nifcloud/request.rb', line 23 def put(path, ={}) set_query() validate @client.put(@endpoint + path, ) end |