Class: Printavo::Resources::Transactions

Inherits:
Base
  • Object
show all
Defined in:
lib/printavo/resources/transactions.rb

Constant Summary collapse

ALL_QUERY =
File.read(File.join(__dir__, '../graphql/transactions/all.graphql')).freeze
FIND_QUERY =
File.read(File.join(__dir__, '../graphql/transactions/find.graphql')).freeze

Instance Method Summary collapse

Methods inherited from Base

#all_pages, #each_page, #initialize

Constructor Details

This class inherits a constructor from Printavo::Resources::Base

Instance Method Details

#all(order_id:, first: 25, after: nil) ⇒ Object



10
11
12
# File 'lib/printavo/resources/transactions.rb', line 10

def all(order_id:, first: 25, after: nil)
  fetch_page(order_id: order_id, first: first, after: after).records
end

#find(id) ⇒ Object



14
15
16
17
# File 'lib/printavo/resources/transactions.rb', line 14

def find(id)
  data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
  Printavo::Transaction.new(data['transaction'])
end