Class: HttpStore::Client
- Inherits:
-
Object
- Object
- HttpStore::Client
- Defined in:
- lib/http_store/client.rb
Constant Summary
Constants included from Helpers::Storable
Helpers::Storable::STRING_LIMIT_SIZE, Helpers::Storable::TEXT_LIMIT_SIZE
Instance Attribute Summary collapse
-
#meta ⇒ Object
Returns the value of attribute meta.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Client
constructor
A new instance of Client.
- #retry! ⇒ Object
Methods included from Helpers::Storable
#gen_storable_meta, #json_safe_parse, #load_storeable_record, #storable, #storable_string, #store_class, #store_request, #storeable_record, #use_cache?
Methods included from Helpers::Responseable
#after_response, #build_response, #build_response_code, #build_response_data, #cache_response?, #json_response?, #need_retry?, #response_valid?
Methods included from Helpers::Requestable
#format_request, #gen_request_digest, #get?, #json_request?, #post?, #request_digest_hash, #request_valid?, #set_request, #uri
Constructor Details
#initialize(args) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/http_store/client.rb', line 13 def initialize(args) @meta = Hashie::Mash.new(args) build_request return unless request_valid? load_storeable_record and return if use_cache? execute # send request retry! while need_retry? && retry_times.to_i > 0 after_response end |
Instance Attribute Details
#meta ⇒ Object
Returns the value of attribute meta.
3 4 5 |
# File 'lib/http_store/client.rb', line 3 def @meta end |
Class Method Details
.execute(requestable, other_params = {}) ⇒ Object
9 10 11 |
# File 'lib/http_store/client.rb', line 9 def self.execute(requestable, other_params = {}) new(requestable: requestable, other_params: other_params) end |
Instance Method Details
#retry! ⇒ Object
26 27 28 29 30 31 |
# File 'lib/http_store/client.rb', line 26 def retry! @meta.retry_times = retry_times.to_i - 1 @meta.force = true execute end |