Class: XSR::Client
- Inherits:
-
Object
- Object
- XSR::Client
- Defined in:
- lib/xsr/client.rb
Overview
XSR Client class, holding methods to handle HTTP requests
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#ca_file ⇒ Object
Returns the value of attribute ca_file.
-
#default_header ⇒ Object
Returns the value of attribute default_header.
-
#skip_cert_check ⇒ Object
Returns the value of attribute skip_cert_check.
Instance Method Summary collapse
- #delete(path, options = {}) ⇒ Object
- #get(path, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #post(path, options = {}) ⇒ Object
- #put(path, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 |
# File 'lib/xsr/client.rb', line 9 def initialize( = {}) @base_url = [:base_url] @base_header = [:header] @skip_cert_check = [:skip_cert_check] @ca_file = [:ca_file] end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/xsr/client.rb', line 4 def base_url @base_url end |
#ca_file ⇒ Object
Returns the value of attribute ca_file.
7 8 9 |
# File 'lib/xsr/client.rb', line 7 def ca_file @ca_file end |
#default_header ⇒ Object
Returns the value of attribute default_header.
5 6 7 |
# File 'lib/xsr/client.rb', line 5 def default_header @default_header end |
#skip_cert_check ⇒ Object
Returns the value of attribute skip_cert_check.
6 7 8 |
# File 'lib/xsr/client.rb', line 6 def skip_cert_check @skip_cert_check end |
Instance Method Details
#delete(path, options = {}) ⇒ Object
20 21 22 |
# File 'lib/xsr/client.rb', line 20 def delete(path, = {}) request_with_data(path, ) { |uri| Net::HTTP::Delete.new(uri.to_s) } end |
#get(path, options = {}) ⇒ Object
28 29 30 |
# File 'lib/xsr/client.rb', line 28 def get(path, = {}) request_with_data(path, ) { |uri| Net::HTTP::Get.new(uri.to_s) } end |
#post(path, options = {}) ⇒ Object
16 17 18 |
# File 'lib/xsr/client.rb', line 16 def post(path, = {}) request_with_data(path, ) { |uri| Net::HTTP::Post.new(uri.to_s) } end |
#put(path, options = {}) ⇒ Object
24 25 26 |
# File 'lib/xsr/client.rb', line 24 def put(path, = {}) request_with_data(path, ) { |uri| Net::HTTP::Put.new(uri.to_s) } end |