Class: SimpleClient::Client
- Inherits:
-
Object
- Object
- SimpleClient::Client
- Defined in:
- lib/simple-client/simple-client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#request_headers ⇒ Object
Returns the value of attribute request_headers.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
-
#response_code ⇒ Object
readonly
Returns the value of attribute response_code.
-
#response_headers ⇒ Object
readonly
Returns the value of attribute response_headers.
-
#ssl_client_cert ⇒ Object
Returns the value of attribute ssl_client_cert.
Instance Method Summary collapse
-
#delete(url, params = {}) ⇒ SimpleClient::Client
Wrapper for Net::HTTP Delete.
-
#get(url, params = {}) ⇒ SimpleClient::Client
Wrapper for Net::HTTP Get.
-
#initialize ⇒ Client
constructor
A new instance of Client.
-
#post(url, params = {}) ⇒ SimpleClient::Client
Wrapper for Net::HTTP Post.
-
#put(url, params = {}) ⇒ SimpleClient::Client
Wrapper for Net::HTTP Put.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/simple-client/simple-client.rb', line 10 def initialize @response = nil @response_headers = {} end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
8 9 10 |
# File 'lib/simple-client/simple-client.rb', line 8 def body @body end |
#request_headers ⇒ Object
Returns the value of attribute request_headers.
8 9 10 |
# File 'lib/simple-client/simple-client.rb', line 8 def request_headers @request_headers end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/simple-client/simple-client.rb', line 7 def response @response end |
#response_body ⇒ Object (readonly)
Returns the value of attribute response_body.
7 8 9 |
# File 'lib/simple-client/simple-client.rb', line 7 def response_body @response_body end |
#response_code ⇒ Object (readonly)
Returns the value of attribute response_code.
7 8 9 |
# File 'lib/simple-client/simple-client.rb', line 7 def response_code @response_code end |
#response_headers ⇒ Object (readonly)
Returns the value of attribute response_headers.
7 8 9 |
# File 'lib/simple-client/simple-client.rb', line 7 def response_headers @response_headers end |
#ssl_client_cert ⇒ Object
Returns the value of attribute ssl_client_cert.
8 9 10 |
# File 'lib/simple-client/simple-client.rb', line 8 def ssl_client_cert @ssl_client_cert end |
Instance Method Details
#delete(url, params = {}) ⇒ SimpleClient::Client
Wrapper for Net::HTTP Delete
=> ‘bar, ’User-Agent’ => ‘Firefox’}
62 63 64 65 |
# File 'lib/simple-client/simple-client.rb', line 62 def delete(url, params = {}) delete = DeleteRequest.new do_request(delete, url, params) end |
#get(url, params = {}) ⇒ SimpleClient::Client
Wrapper for Net::HTTP Get
=> ‘bar, ’User-Agent’ => ‘Firefox’}
23 24 25 26 |
# File 'lib/simple-client/simple-client.rb', line 23 def get(url, params = {}) get = GetRequest.new do_request(get, url, params) end |
#post(url, params = {}) ⇒ SimpleClient::Client
Wrapper for Net::HTTP Post
=> ‘bar, ’User-Agent’ => ‘Firefox’, :body => ‘abc’}
36 37 38 39 |
# File 'lib/simple-client/simple-client.rb', line 36 def post(url, params = {}) post = PostRequest.new do_request(post, url, params) end |
#put(url, params = {}) ⇒ SimpleClient::Client
Wrapper for Net::HTTP Put
=> ‘bar, ’User-Agent’ => ‘Firefox’, :body => ‘abc’}
49 50 51 52 |
# File 'lib/simple-client/simple-client.rb', line 49 def put(url, params = {}) put = PutRequest.new do_request(put, url, params) end |