Module: ACTIVEWAVE
- Defined in:
- lib/activewave.rb
Constant Summary collapse
- WAVE_API_URL =
"https://gql.waveapps.com/graphql/public"- BUSINESS_ID =
ENV['BUSINESS_ID']
- API_TOKEN =
ENV['API_TOKEN']
- LIST_ALL_PRODUCTS_QUERY =
%{ business(id: "#{BUSINESS_ID}") { id products(page: 1, pageSize: 100) { pageInfo { currentPage totalPages totalCount } edges { node { id name description unitPrice defaultSalesTaxes { id name abbreviation rate } isSold isBought isArchived createdAt modifiedAt } } } } }- LIST_CUSTOMERS_QUERY =
%{ business(id: "#{BUSINESS_ID}") { id customers(page: 1, pageSize: 100, sort: [NAME_ASC]) { pageInfo { currentPage totalPages totalCount } edges { node { id name email } } } } }- LIST_ALL_INVOICES_QUERY =
%{ business(id: "#{BUSINESS_ID}") { id isClassicInvoicing invoices(page: 0, pageSize: 100) { pageInfo { currentPage totalPages totalCount } edges { node { id createdAt modifiedAt pdfUrl viewUrl status title subhead invoiceNumber invoiceDate poNumber customer { id name # Can add additional customer fields here } currency { code } dueDate amountDue { value currency { symbol } } amountPaid { value currency { symbol } } taxTotal { value currency { symbol } } total { value currency { symbol } } exchangeRate footer memo disableCreditCardPayments disableBankPayments itemTitle unitTitle priceTitle amountTitle hideName hideDescription hideUnit hidePrice hideAmount items { product { id name # Can add additional product fields here } description quantity price subtotal { value currency { symbol } } total { value currency { symbol } } account { id name subtype { name value } # Can add additional account fields here } taxes { amount { value } salesTax { id name # Can add additional sales tax fields here } } } lastSentAt lastSentVia lastViewedAt } } } } }- LIST_BUSINESSES =
%{ businesses(page: 1, pageSize: 10) { pageInfo { currentPage totalPages totalCount } edges { node { id name isClassicAccounting isClassicInvoicing isPersonal } } } }- LIST_USERS =
%{ user { id defaultEmail } }- @@https =
Net::HTTP.new(url.host, url.port)
- @@request =
Net::HTTP::Post.new(url)
Class Method Summary collapse
- .create_customer(name, first_name, last_name, email = nil) ⇒ Object
- .create_expense_record(date, anchor_account_id, line_item_account_id, amount, desc) ⇒ Object
- .create_invoice(driver_id, product_id, status = "SAVED") ⇒ Object
- .create_sales_record(date, anchor_account_id, line_item_account_id, amount, desc) ⇒ Object
- .current_user ⇒ Object
- .get_current_user ⇒ Object
- .get_user_details ⇒ Object
- .list_all_assets ⇒ Object
- .list_all_businesses ⇒ Object
- .list_all_customers ⇒ Object
- .list_all_expenses ⇒ Object
- .list_all_income ⇒ Object
- .list_all_incomes ⇒ Object
- .list_all_invoices ⇒ Object
- .list_all_products ⇒ Object
- .list_incomes ⇒ Object
- .list_users ⇒ Object
- .user ⇒ Object
Class Method Details
.create_customer(name, first_name, last_name, email = nil) ⇒ Object
223 224 225 |
# File 'lib/activewave.rb', line 223 def self.create_customer(name, first_name, last_name, email=nil) create_a_customer(name, first_name, last_name, email) end |
.create_expense_record(date, anchor_account_id, line_item_account_id, amount, desc) ⇒ Object
236 237 238 |
# File 'lib/activewave.rb', line 236 def self.create_expense_record(date, anchor_account_id, line_item_account_id, amount, desc) create_a_transaction(date, anchor_account_id, line_item_account_id, amount, desc, "EXPENSES") end |
.create_invoice(driver_id, product_id, status = "SAVED") ⇒ Object
227 228 229 |
# File 'lib/activewave.rb', line 227 def self.create_invoice(driver_id, product_id, status="SAVED") create_an_invoice(driver_id, product_id, status) end |
.create_sales_record(date, anchor_account_id, line_item_account_id, amount, desc) ⇒ Object
232 233 234 |
# File 'lib/activewave.rb', line 232 def self.create_sales_record(date, anchor_account_id, line_item_account_id, amount, desc) create_a_transaction(date, anchor_account_id, line_item_account_id, amount, desc) end |
.current_user ⇒ Object
244 245 246 |
# File 'lib/activewave.rb', line 244 def self.current_user execute(LIST_USERS) end |
.get_current_user ⇒ Object
252 253 254 |
# File 'lib/activewave.rb', line 252 def self.get_current_user execute(LIST_USERS) end |
.get_user_details ⇒ Object
248 249 250 |
# File 'lib/activewave.rb', line 248 def self.get_user_details execute(LIST_USERS) end |
.list_all_assets ⇒ Object
276 277 278 |
# File 'lib/activewave.rb', line 276 def self.list_all_assets list_assets_or_liabilities() end |
.list_all_businesses ⇒ Object
272 273 274 |
# File 'lib/activewave.rb', line 272 def self.list_all_businesses execute(LIST_BUSINESSES) end |
.list_all_customers ⇒ Object
264 265 266 |
# File 'lib/activewave.rb', line 264 def self.list_all_customers execute(LIST_CUSTOMERS_QUERY) end |
.list_all_expenses ⇒ Object
292 293 294 |
# File 'lib/activewave.rb', line 292 def self.list_all_expenses list_assets_or_liabilities("EXPENSE") end |
.list_all_income ⇒ Object
284 285 286 |
# File 'lib/activewave.rb', line 284 def self.list_all_income list_assets_or_liabilities("INCOME") end |
.list_all_incomes ⇒ Object
280 281 282 |
# File 'lib/activewave.rb', line 280 def self.list_all_incomes list_assets_or_liabilities("INCOME") end |
.list_all_invoices ⇒ Object
268 269 270 |
# File 'lib/activewave.rb', line 268 def self.list_all_invoices execute(LIST_ALL_INVOICES_QUERY) end |
.list_all_products ⇒ Object
260 261 262 |
# File 'lib/activewave.rb', line 260 def self.list_all_products execute(LIST_ALL_PRODUCTS_QUERY) end |
.list_incomes ⇒ Object
288 289 290 |
# File 'lib/activewave.rb', line 288 def self.list_incomes list_assets_or_liabilities("INCOME") end |
.list_users ⇒ Object
240 241 242 |
# File 'lib/activewave.rb', line 240 def self.list_users execute(LIST_USERS) end |
.user ⇒ Object
256 257 258 |
# File 'lib/activewave.rb', line 256 def self.user execute(LIST_USERS) end |