Class: ShopsavvyDataApi::APIMeta
- Inherits:
-
Object
- Object
- ShopsavvyDataApi::APIMeta
- Defined in:
- lib/shopsavvy_data_api/models.rb
Overview
API response metadata containing credit usage info
Instance Attribute Summary collapse
-
#credits_remaining ⇒ Object
readonly
Returns the value of attribute credits_remaining.
-
#credits_used ⇒ Object
readonly
Returns the value of attribute credits_used.
-
#rate_limit_remaining ⇒ Object
readonly
Returns the value of attribute rate_limit_remaining.
Instance Method Summary collapse
-
#initialize(data) ⇒ APIMeta
constructor
A new instance of APIMeta.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ APIMeta
Returns a new instance of APIMeta.
31 32 33 34 35 |
# File 'lib/shopsavvy_data_api/models.rb', line 31 def initialize(data) @credits_used = data["credits_used"].to_i @credits_remaining = data["credits_remaining"].to_i @rate_limit_remaining = data["rate_limit_remaining"]&.to_i end |
Instance Attribute Details
#credits_remaining ⇒ Object (readonly)
Returns the value of attribute credits_remaining.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def credits_remaining @credits_remaining end |
#credits_used ⇒ Object (readonly)
Returns the value of attribute credits_used.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def credits_used @credits_used end |
#rate_limit_remaining ⇒ Object (readonly)
Returns the value of attribute rate_limit_remaining.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def rate_limit_remaining @rate_limit_remaining end |
Instance Method Details
#to_h ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/shopsavvy_data_api/models.rb', line 37 def to_h { credits_used: credits_used, credits_remaining: credits_remaining, rate_limit_remaining: rate_limit_remaining } end |