Class: XSR::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/xsr/client.rb

Overview

XSR Client class, holding methods to handle HTTP requests

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  @base_url = options[:base_url]
  @base_header = options[:header]
  @skip_cert_check = options[:skip_cert_check]
  @ca_file = options[:ca_file]
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



4
5
6
# File 'lib/xsr/client.rb', line 4

def base_url
  @base_url
end

#ca_fileObject

Returns the value of attribute ca_file.



7
8
9
# File 'lib/xsr/client.rb', line 7

def ca_file
  @ca_file
end

#default_headerObject

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_checkObject

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, options = {})
  request_with_data(path, options) { |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, options = {})
  request_with_data(path, options) { |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, options = {})
  request_with_data(path, options) { |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, options = {})
  request_with_data(path, options) { |uri| Net::HTTP::Put.new(uri.to_s) }
end