Class: Printavo::Resources::Users

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

Constant Summary collapse

ALL_QUERY =
File.read(File.join(__dir__, '../graphql/users/all.graphql')).freeze
FIND_QUERY =
File.read(File.join(__dir__, '../graphql/users/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(first: 25, after: nil) ⇒ Object



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

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

#find(id) ⇒ Object



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

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