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
:nodoc:.
Methods inherited from Request
#build_request, #do_request, #execute_callback_if_any, #invoke
Constructor Details
#initialize(wrest_uri, parameters = {}, headers = {}, options = {}) ⇒ Get
Returns a new instance of Get.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wrest/native/get.rb', line 16 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.
14 15 16 |
# File 'lib/wrest/native/get.rb', line 14 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.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/wrest/native/get.rb', line 36 def ==(other) return true if self.equal?(other) return false unless other.class == self.class return true if self.uri == other.uri and self.parameters == other.parameters and self.username == other.username and self.password == other.password and self.verify_mode == other.verify_mode false end |
#build_request_without_cache_store(cache_validation_headers) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/wrest/native/get.rb', line 60 def build_request_without_cache_store(cache_validation_headers) new_headers = headers.clone.merge cache_validation_headers = .clone.tap { |opts| opts.delete :cache_store; opts[:disable_cache] = true } # do not run this through the caching mechanism. new_request = Wrest::Native::Get.new(uri, parameters, new_headers, ) new_request end |
#full_uri_string ⇒ Object
68 69 70 |
# File 'lib/wrest/native/get.rb', line 68 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.
49 50 51 |
# File 'lib/wrest/native/get.rb', line 49 def hash self.uri.hash + self.parameters.hash + self.username.hash + self.password.hash + self.verify_mode.hash + 20110106 end |
#invoke_with_cache_check ⇒ Object
:nodoc:
54 55 56 |
# File 'lib/wrest/native/get.rb', line 54 def invoke_with_cache_check cache_proxy.get end |