Class: Printavo::Client
- Inherits:
-
Object
- Object
- Printavo::Client
- Defined in:
- lib/printavo/client.rb
Instance Attribute Summary collapse
-
#graphql ⇒ Object
readonly
Returns the value of attribute graphql.
Instance Method Summary collapse
- #account ⇒ Object
- #approval_requests ⇒ Object
- #categories ⇒ Object
- #contacts ⇒ Object
- #contractor_profiles ⇒ Object
- #custom_addresses ⇒ Object
- #customers ⇒ Object
- #delivery_methods ⇒ Object
- #email_templates ⇒ Object
- #expenses ⇒ Object
- #fees ⇒ Object
- #imprints ⇒ Object
-
#initialize(email:, token:, timeout: 30, max_retries: 2, retry_on_rate_limit: true, cache: nil, default_ttl: 300) ⇒ Client
constructor
Creates a new Printavo API client.
- #inquiries ⇒ Object
- #invoices ⇒ Object
- #jobs ⇒ Object
- #line_item_groups ⇒ Object
- #line_items ⇒ Object
- #login ⇒ Object
- #logout ⇒ Object
- #merch_orders ⇒ Object
- #merch_stores ⇒ Object
- #mockups ⇒ Object
- #orders ⇒ Object
- #payment_requests ⇒ Object
- #payment_terms ⇒ Object
- #payments ⇒ Object
- #preset_task_groups ⇒ Object
- #preset_tasks ⇒ Object
- #pricing_matrices ⇒ Object
- #production_files ⇒ Object
- #products ⇒ Object
- #statuses ⇒ Object
- #tasks ⇒ Object
- #threads ⇒ Object
- #transaction_payments ⇒ Object
- #transactions ⇒ Object
- #types_of_work ⇒ Object
- #users ⇒ Object
- #vendors ⇒ Object
Constructor Details
#initialize(email:, token:, timeout: 30, max_retries: 2, retry_on_rate_limit: true, cache: nil, default_ttl: 300) ⇒ Client
Creates a new Printavo API client. Each instance is independent — multiple clients with different credentials can coexist in one process.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/printavo/client.rb', line 41 def initialize(email:, token:, timeout: 30, max_retries: 2, retry_on_rate_limit: true, # rubocop:disable Metrics/ParameterLists cache: nil, default_ttl: 300) connection = Connection.new( email: email, token: token, timeout: timeout, max_retries: max_retries, retry_on_rate_limit: retry_on_rate_limit ).build @graphql = GraphqlClient.new( connection, cache: cache, default_ttl: default_ttl, sensitive_values: [email, token] ) end |
Instance Attribute Details
#graphql ⇒ Object (readonly)
Returns the value of attribute graphql.
6 7 8 |
# File 'lib/printavo/client.rb', line 6 def graphql @graphql end |
Instance Method Details
#account ⇒ Object
58 59 60 |
# File 'lib/printavo/client.rb', line 58 def account Resources::Account.new(@graphql) end |
#approval_requests ⇒ Object
62 63 64 |
# File 'lib/printavo/client.rb', line 62 def approval_requests Resources::ApprovalRequests.new(@graphql) end |
#categories ⇒ Object
66 67 68 |
# File 'lib/printavo/client.rb', line 66 def categories Resources::Categories.new(@graphql) end |
#contacts ⇒ Object
70 71 72 |
# File 'lib/printavo/client.rb', line 70 def contacts Resources::Contacts.new(@graphql) end |
#contractor_profiles ⇒ Object
74 75 76 |
# File 'lib/printavo/client.rb', line 74 def contractor_profiles Resources::ContractorProfiles.new(@graphql) end |
#custom_addresses ⇒ Object
78 79 80 |
# File 'lib/printavo/client.rb', line 78 def custom_addresses Resources::CustomAddresses.new(@graphql) end |
#customers ⇒ Object
82 83 84 |
# File 'lib/printavo/client.rb', line 82 def customers Resources::Customers.new(@graphql) end |
#delivery_methods ⇒ Object
86 87 88 |
# File 'lib/printavo/client.rb', line 86 def delivery_methods Resources::DeliveryMethods.new(@graphql) end |
#email_templates ⇒ Object
90 91 92 |
# File 'lib/printavo/client.rb', line 90 def email_templates Resources::EmailTemplates.new(@graphql) end |
#expenses ⇒ Object
94 95 96 |
# File 'lib/printavo/client.rb', line 94 def expenses Resources::Expenses.new(@graphql) end |
#fees ⇒ Object
98 99 100 |
# File 'lib/printavo/client.rb', line 98 def fees Resources::Fees.new(@graphql) end |
#imprints ⇒ Object
102 103 104 |
# File 'lib/printavo/client.rb', line 102 def imprints Resources::Imprints.new(@graphql) end |
#inquiries ⇒ Object
106 107 108 |
# File 'lib/printavo/client.rb', line 106 def inquiries Resources::Inquiries.new(@graphql) end |
#invoices ⇒ Object
110 111 112 |
# File 'lib/printavo/client.rb', line 110 def invoices Resources::Invoices.new(@graphql) end |
#jobs ⇒ Object
114 115 116 |
# File 'lib/printavo/client.rb', line 114 def jobs Resources::Jobs.new(@graphql) end |
#line_item_groups ⇒ Object
118 119 120 |
# File 'lib/printavo/client.rb', line 118 def line_item_groups Resources::LineItemGroups.new(@graphql) end |
#line_items ⇒ Object
122 123 124 |
# File 'lib/printavo/client.rb', line 122 def line_items Resources::LineItems.new(@graphql) end |
#login ⇒ Object
126 127 128 129 130 |
# File 'lib/printavo/client.rb', line 126 def login(*) raise NotImplementedError, 'login is not supported — this gem authenticates via email + token headers. ' \ 'Pass credentials to Printavo::Client.new(email:, token:) instead.' end |
#logout ⇒ Object
132 133 134 135 136 |
# File 'lib/printavo/client.rb', line 132 def logout(*) raise NotImplementedError, 'logout is not supported — this gem uses stateless header-based auth. ' \ 'Simply discard the client instance when done.' end |
#merch_orders ⇒ Object
138 139 140 |
# File 'lib/printavo/client.rb', line 138 def merch_orders Resources::MerchOrders.new(@graphql) end |
#merch_stores ⇒ Object
142 143 144 |
# File 'lib/printavo/client.rb', line 142 def merch_stores Resources::MerchStores.new(@graphql) end |
#mockups ⇒ Object
146 147 148 |
# File 'lib/printavo/client.rb', line 146 def mockups Resources::Mockups.new(@graphql) end |
#orders ⇒ Object
150 151 152 |
# File 'lib/printavo/client.rb', line 150 def orders Resources::Orders.new(@graphql) end |
#payment_requests ⇒ Object
154 155 156 |
# File 'lib/printavo/client.rb', line 154 def payment_requests Resources::PaymentRequests.new(@graphql) end |
#payment_terms ⇒ Object
158 159 160 |
# File 'lib/printavo/client.rb', line 158 def payment_terms Resources::PaymentTerms.new(@graphql) end |
#payments ⇒ Object
162 163 164 |
# File 'lib/printavo/client.rb', line 162 def payments Resources::Payments.new(@graphql) end |
#preset_task_groups ⇒ Object
166 167 168 |
# File 'lib/printavo/client.rb', line 166 def preset_task_groups Resources::PresetTaskGroups.new(@graphql) end |
#preset_tasks ⇒ Object
170 171 172 |
# File 'lib/printavo/client.rb', line 170 def preset_tasks Resources::PresetTasks.new(@graphql) end |
#pricing_matrices ⇒ Object
174 175 176 |
# File 'lib/printavo/client.rb', line 174 def pricing_matrices Resources::PricingMatrices.new(@graphql) end |
#production_files ⇒ Object
178 179 180 |
# File 'lib/printavo/client.rb', line 178 def production_files Resources::ProductionFiles.new(@graphql) end |
#products ⇒ Object
182 183 184 |
# File 'lib/printavo/client.rb', line 182 def products Resources::Products.new(@graphql) end |
#statuses ⇒ Object
186 187 188 |
# File 'lib/printavo/client.rb', line 186 def statuses Resources::Statuses.new(@graphql) end |
#tasks ⇒ Object
190 191 192 |
# File 'lib/printavo/client.rb', line 190 def tasks Resources::Tasks.new(@graphql) end |
#threads ⇒ Object
194 195 196 |
# File 'lib/printavo/client.rb', line 194 def threads Resources::Threads.new(@graphql) end |
#transaction_payments ⇒ Object
198 199 200 |
# File 'lib/printavo/client.rb', line 198 def transaction_payments Resources::TransactionPayments.new(@graphql) end |
#transactions ⇒ Object
202 203 204 |
# File 'lib/printavo/client.rb', line 202 def transactions Resources::Transactions.new(@graphql) end |
#types_of_work ⇒ Object
206 207 208 |
# File 'lib/printavo/client.rb', line 206 def types_of_work Resources::TypesOfWork.new(@graphql) end |