Class: ShopifyGraphql::Response
- Inherits:
-
Object
- Object
- ShopifyGraphql::Response
- Defined in:
- lib/shopify_graphql/response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #points_left ⇒ Object
- #points_limit ⇒ Object
- #points_maxed?(threshold: 0) ⇒ Boolean
- #points_restore_rate ⇒ Object
- #query_cost ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 11 |
# File 'lib/shopify_graphql/response.rb', line 6 def initialize(response) @raw = response @data = response.data @extensions = response.extensions @errors = response.errors end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/shopify_graphql/response.rb', line 4 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/shopify_graphql/response.rb', line 3 def errors @errors end |
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
3 4 5 |
# File 'lib/shopify_graphql/response.rb', line 3 def extensions @extensions end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
3 4 5 |
# File 'lib/shopify_graphql/response.rb', line 3 def raw @raw end |
Instance Method Details
#points_left ⇒ Object
13 14 15 |
# File 'lib/shopify_graphql/response.rb', line 13 def points_left extensions&.cost&.throttleStatus&.currentlyAvailable end |
#points_limit ⇒ Object
17 18 19 |
# File 'lib/shopify_graphql/response.rb', line 17 def points_limit extensions&.cost&.throttleStatus&.maximumAvailable end |
#points_maxed?(threshold: 0) ⇒ Boolean
29 30 31 |
# File 'lib/shopify_graphql/response.rb', line 29 def points_maxed?(threshold: 0) points_left < threshold end |
#points_restore_rate ⇒ Object
21 22 23 |
# File 'lib/shopify_graphql/response.rb', line 21 def points_restore_rate extensions&.cost&.throttleStatus&.restoreRate end |
#query_cost ⇒ Object
25 26 27 |
# File 'lib/shopify_graphql/response.rb', line 25 def query_cost extensions&.cost&.actualQueryCost end |