Class: Wrest::Native::Get
Constant Summary collapse
- QUERY_PARAMS_SEPERATOR =
'?'- EMPTY_QUERY_PARAMS =
''
Instance Attribute Summary collapse
-
#cache_proxy ⇒ Object
readonly
Returns the value of attribute cache_proxy.
Attributes inherited from Request
#body, #ca_path, #cache_store, #connection, #follow_redirects, #follow_redirects_count, #follow_redirects_limit, #headers, #http_request, #options, #parameters, #password, #timeout, #uri, #username, #verify_mode
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality between two Wrest::Native::Get objects.
- #build_request_without_cache_store(cache_validation_headers) ⇒ Object
- #full_uri_string ⇒ Object
-
#hash ⇒ Object
Returns a hash value for this Wrest::Native::Get object.
-
#initialize(wrest_uri, parameters = {}, headers = {}, options = {}) ⇒ Get
constructor
A new instance of Get.
-
#invoke_with_cache_check ⇒ Object
(also: #invoke)
:nodoc:.
Methods inherited from Request
#build_request, #do_request, #execute_callback_if_any
Constructor Details
#initialize(wrest_uri, parameters = {}, headers = {}, options = {}) ⇒ Get
Returns a new instance of Get.
19 20 21 22 23 24 25 26 27 |
# File 'lib/wrest/native/get.rb', line 19 def initialize(wrest_uri, parameters = {}, headers = {}, = {}) follow_redirects = [:follow_redirects] [:follow_redirects] = (follow_redirects.nil? ? true : follow_redirects) cache_store = ([:cache_store] || Wrest::Caching.default_store) unless [:disable_cache] @cache_proxy = Wrest::CacheProxy.new(self, cache_store) super(wrest_uri, Net::HTTP::Get, parameters, nil, headers, ) end |
Instance Attribute Details
#cache_proxy ⇒ Object (readonly)
Returns the value of attribute cache_proxy.
17 18 19 |
# File 'lib/wrest/native/get.rb', line 17 def cache_proxy @cache_proxy end |
Instance Method Details
#==(other) ⇒ Object
Checks equality between two Wrest::Native::Get objects. Comparing two Wrest::Native::Get objects with identical values for the following properties would return True.
uri, parameters, username, password and ssh verify_mode.
32 33 34 35 36 37 38 |
# File 'lib/wrest/native/get.rb', line 32 def ==(other) return true if equal?(other) return false unless other.class == self.class return true if these_fields_are_equal(other) false end |
#build_request_without_cache_store(cache_validation_headers) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/wrest/native/get.rb', line 54 def build_request_without_cache_store(cache_validation_headers) new_headers = headers.clone.merge cache_validation_headers = # do not run this through the caching mechanism. .clone.tap do |opts| opts.delete :cache_store opts[:disable_cache] = true end Wrest::Native::Get.new(uri, parameters, new_headers, ) end |
#full_uri_string ⇒ Object
64 65 66 |
# File 'lib/wrest/native/get.rb', line 64 def full_uri_string @uri.to_s + query_params_string end |
#hash ⇒ Object
Returns a hash value for this Wrest::Native::Get object. Objects that returns true when compared using the == operator would return the same hash value also.
42 43 44 |
# File 'lib/wrest/native/get.rb', line 42 def hash [uri, parameters, username, password, verify_mode].hash end |
#invoke_with_cache_check ⇒ Object Also known as: invoke
:nodoc:
47 48 49 |
# File 'lib/wrest/native/get.rb', line 47 def invoke_with_cache_check cache_proxy.get end |