Class: ShopifyApiBruv::Resources::Rest::Resource
- Defined in:
- lib/shopify_api_bruv/resources/rest/resource.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#pagination ⇒ Object
Returns the value of attribute pagination.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config:, method:, path:, body: nil, query: nil) ⇒ Resource
constructor
A new instance of Resource.
Methods inherited from Base
Constructor Details
#initialize(config:, method:, path:, body: nil, query: nil) ⇒ Resource
Returns a new instance of Resource.
10 11 12 13 14 15 16 17 18 |
# File 'lib/shopify_api_bruv/resources/rest/resource.rb', line 10 def initialize(config:, method:, path:, body: nil, query: nil) @client = Clients::Rest::Client.new(config:) @method = method @path = path @body = body @query = query validate end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/shopify_api_bruv/resources/rest/resource.rb', line 7 def body @body end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/shopify_api_bruv/resources/rest/resource.rb', line 7 def client @client end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/shopify_api_bruv/resources/rest/resource.rb', line 7 def method @method end |
#pagination ⇒ Object
Returns the value of attribute pagination.
8 9 10 |
# File 'lib/shopify_api_bruv/resources/rest/resource.rb', line 8 def pagination @pagination end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/shopify_api_bruv/resources/rest/resource.rb', line 7 def path @path end |
#query ⇒ Object
Returns the value of attribute query.
8 9 10 |
# File 'lib/shopify_api_bruv/resources/rest/resource.rb', line 8 def query @query end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/shopify_api_bruv/resources/rest/resource.rb', line 20 def call response = client.public_send(method, path:, body:, query:) pagination = Pagination.new(resource: self, page_info: response.page_info) @pagination = pagination if pagination.page_exists? ResourceResponse.new(body: response.body, headers: response.headers) end |