Class: VIN::Request
- Inherits:
-
Object
- Object
- VIN::Request
- Includes:
- Mixins::Redis
- Defined in:
- lib/vin/request.rb
Constant Summary collapse
- MAX_TRIES =
5
Constants included from Mixins::Redis
Mixins::Redis::DEFAULT_REDIS_URL
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#custom_timestamp ⇒ Object
readonly
Returns the value of attribute custom_timestamp.
-
#data_type ⇒ Object
readonly
Returns the value of attribute data_type.
Instance Method Summary collapse
-
#initialize(config, data_type, count = 1, custom_timestamp: nil) ⇒ Request
constructor
A new instance of Request.
- #response ⇒ Object
Methods included from Mixins::Redis
Constructor Details
#initialize(config, data_type, count = 1, custom_timestamp: nil) ⇒ Request
Returns a new instance of Request.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vin/request.rb', line 9 def initialize(config, data_type, count = 1, custom_timestamp: nil) raise(ArgumentError, "data_type must be a number") unless data_type.is_a?(Numeric) unless config.data_type_allowed_range.include?(data_type) raise(ArgumentError, "data_type is outside the allowed range of #{config.data_type_allowed_range}") end raise(ArgumentError, "count must be a number") unless count.is_a?(Numeric) raise(ArgumentError, "count must be greater than zero") unless count.positive? @tries = 0 @data_type = data_type @count = count @config = config = end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/vin/request.rb', line 7 def config @config end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
7 8 9 |
# File 'lib/vin/request.rb', line 7 def count @count end |
#custom_timestamp ⇒ Object (readonly)
Returns the value of attribute custom_timestamp.
7 8 9 |
# File 'lib/vin/request.rb', line 7 def end |
#data_type ⇒ Object (readonly)
Returns the value of attribute data_type.
7 8 9 |
# File 'lib/vin/request.rb', line 7 def data_type @data_type end |
Instance Method Details
#response ⇒ Object
24 25 26 |
# File 'lib/vin/request.rb', line 24 def response Response.new(try_redis_response) end |