activewave 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/activewave.rb +6 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 728843805e4bb051f3c73ccaf95e804963b74ee358d8ad35e187d7120bb53398
4
- data.tar.gz: ac3ca74144568b0ed69a4622c9681faa8c8a8f3958bf252ae0fae0e94d06c401
3
+ metadata.gz: aa494013de2bd07cc278833bf3c85853cf64fc697711e81effb732143773ba10
4
+ data.tar.gz: a79ab4f1244993283ae25d82b6a78e1447d637a21db0266d79afd8779c82f44f
5
5
  SHA512:
6
- metadata.gz: c3c66cbffa8c240248e3fc1572b79a8b1e4bcffd741713eb5635a9bcdba444923202ddc9d06d41e55256b36960c261ecd4a1f8392398ec6a41845aec05629f6c
7
- data.tar.gz: f0f8ae3a4667653ee8a4ef83e4a1d254f690662b1b1af6e269582e6df0c0629d6b0f9cca29efc52b6aa04cb149d19f9daa4e5e15cc1f5061551ce524c4251fd9
6
+ metadata.gz: c9457ebeb343c219582b4c74264c3028fef74ebc312959d4923accd6cae2ff1819f262577ea94eef99b4a16854716df4863b62324d406c6223b2c5b6fce0c208
7
+ data.tar.gz: c88e97d0066adde6ff6066d1f0dcf0dc634600bccf37ffa77c39f900b63e766d873d191dada91b360a594421828a026adf7a5b31739a100cce4981beb26e22b4
data/lib/activewave.rb CHANGED
@@ -2,14 +2,12 @@ require 'httparty'
2
2
  require 'json'
3
3
  require "uri"
4
4
  require "net/http"
5
- require 'dotenv'
6
- Dotenv.load
7
5
 
8
6
  module ACTIVEWAVE
9
7
 
10
8
  WAVE_API_URL = "https://gql.waveapps.com/graphql/public"
11
- BUSINESS_ID = ENV['BUSINESS_ID']
12
- API_TOKEN = ENV['API_TOKEN']
9
+ BUSINESS_ID = "QnVzaW5lc3M6MDkyMWM2NjItODlhMy00NDk3LTkzYTktNTI2MzE3MGUyNTcx"
10
+ API_TOKEN = "falcL269UemwhAuiPDbu9EirrINIrQ"
13
11
 
14
12
  url = URI(WAVE_API_URL)
15
13
 
@@ -299,27 +297,27 @@ module ACTIVEWAVE
299
297
  current_action = action[type.to_sym]
300
298
  @@request.body = "{\"query\":\" mutation ($input:MoneyTransactionCreateInput!){\\n moneyTransactionCreate(input:$input){\\n didSucceed\\n inputErrors{\\n path\\n message\\n code\\n }\\n transaction{\\n id\\n }\\n }\\n }\",\"variables\":{\"input\":{\"businessId\":\"#{BUSINESS_ID}\",\"externalId\":\"#{desc + Time.now.to_s}\",\"date\":\"#{date}\",\"description\":\"#{desc}\",\"anchor\":{\"accountId\":\"#{anchor_account_id}\",\"amount\":#{amount},\"direction\":\"#{current_action[0]}\"},\"lineItems\":[{\"accountId\":\"#{line_item_account_id}\",\"amount\":#{amount},\"balance\":\"#{current_action[1]}\"}]}}}"
301
299
  response = @@https.request(@@request)
302
- response.read_body
300
+ JSON.parse(response.read_body)
303
301
  end
304
302
 
305
303
  def self.create_an_invoice(driver_id, product_id, status="SAVED")
306
304
  @@request.body = "{\"query\":\"mutation ($input: InvoiceCreateInput!) {\\n invoiceCreate(input: $input) {\\n didSucceed\\n inputErrors {\\n message\\n code\\n path\\n }\\n invoice {\\n id\\n createdAt\\n modifiedAt\\n pdfUrl\\n viewUrl\\n status\\n title\\n subhead\\n invoiceNumber\\n invoiceDate\\n poNumber\\n customer {\\n id\\n name\\n # Can add additional customer fields here\\n }\\n currency {\\n code\\n }\\n dueDate\\n amountDue {\\n value\\n currency {\\n symbol\\n }\\n }\\n amountPaid {\\n value\\n currency {\\n symbol\\n }\\n }\\n taxTotal {\\n value\\n currency {\\n symbol\\n }\\n }\\n total {\\n value\\n currency {\\n symbol\\n }\\n }\\n exchangeRate\\n footer\\n memo\\n disableCreditCardPayments\\n disableBankPayments\\n itemTitle\\n unitTitle\\n priceTitle\\n amountTitle\\n hideName\\n hideDescription\\n hideUnit\\n hidePrice\\n hideAmount\\n items {\\n product {\\n id\\n name\\n # Can add additional product fields here\\n }\\n description\\n quantity\\n price\\n subtotal {\\n value\\n currency {\\n symbol\\n }\\n }\\n total {\\n value\\n currency {\\n symbol\\n }\\n }\\n account {\\n id\\n name\\n subtype {\\n name\\n value\\n }\\n # Can add additional account fields here\\n }\\n taxes {\\n amount {\\n value\\n }\\n salesTax {\\n id\\n name\\n # Can add additional sales tax fields here\\n }\\n }\\n }\\n lastSentAt\\n lastSentVia\\n lastViewedAt\\n }\\n }\\n}\",\"variables\":{\"input\":{\"businessId\":\"#{BUSINESS_ID}\",\"customerId\":\"#{driver_id}\",\"items\":[{\"productId\":\"#{product_id}\"}], \"status\":\"#{status}\"}}}"
307
305
  response = @@https.request(@@request)
308
- response.read_body
306
+ JSON.parse(response.read_body)
309
307
  end
310
308
 
311
309
 
312
310
  def self.create_a_customer(name, first_name, last_name, email)
313
311
  @@request.body = "{\"query\":\"mutation ($input: CustomerCreateInput!) {\\n customerCreate(input: $input) {\\n didSucceed\\n inputErrors {\\n code\\n message\\n path\\n }\\n customer {\\n id\\n name\\n firstName\\n lastName\\n email\\n address {\\n addressLine1\\n addressLine2\\n city\\n province {\\n code\\n name\\n }\\n country {\\n code\\n name\\n }\\n postalCode\\n }\\n currency {\\n code\\n }\\n }\\n }\\n}\",\"variables\":{\"input\":{\"businessId\":\"#{BUSINESS_ID}\",\"name\":\"#{name}\",\"firstName\":\"#{first_name}\",\"lastName\":\"#{last_name}\",\"email\":\"#{email}\",\"currency\":\"GHS\"}}}"
314
312
  response = @@https.request(@@request)
315
- response.read_body
313
+ JSON.parse(response.read_body)
316
314
  end
317
315
 
318
316
 
319
317
  def self.list_assets_or_liabilities(filter="ASSET")
320
318
  @@request.body = "{\"query\":\"query ($businessId: ID!, $page: Int!, $pageSize: Int!) {\\n business(id: $businessId) {\\n id\\n accounts(page: $page, pageSize: $pageSize, types: [#{filter}]) {\\n pageInfo {\\n currentPage\\n totalPages\\n totalCount\\n }\\n edges {\\n node {\\n id\\n name\\n description\\n displayId\\n type {\\n name\\n value\\n }\\n subtype {\\n name\\n value\\n }\\n normalBalanceType\\n isArchived\\n }\\n }\\n }\\n }\\n}\",\"variables\":{\"businessId\":\"#{BUSINESS_ID}\",\"page\":1,\"pageSize\":100}}"
321
319
  response = @@https.request(@@request)
322
- response.read_body
320
+ JSON.parse(response.read_body)
323
321
  end
324
322
 
325
323
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activewave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - CHARALES OPOKU-AGYEMANG