trackvia 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackvia.rb +37 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4bdb6dcb903564719586711ddca6b684ef6ed3d
4
- data.tar.gz: c2a1c9bfd4fcd32177bf2df4c086f96c50ea0d61
3
+ metadata.gz: c77a1c53d03105686c18ce90ce69bf69d8939821
4
+ data.tar.gz: dd8a630f9988743edcc5d123a8627d1b2655f2f1
5
5
  SHA512:
6
- metadata.gz: 9ab37cd5975af1cbaa932c95997feb59e8277fef88838f6cbc682b7685f72cbbcd8071333eac691c875fea1f4ce83837d27fe44727d589e4494c133b3ba7896d
7
- data.tar.gz: 08c09cd9454d58812675a64438b738c2497c0e9849ae57d27c924daaabcd069f41e879c05adb0973dd6f4b06d19b6dec7a78fdf5c7e48d776edee677b85d1f94
6
+ metadata.gz: a59e2f638223f370c7259666a3d802c39be764bd5f8eba3eb29c55959ce6e01fac3e398c3eb38c79844dda223b9c2607651520177600fac05be5ec5706169136
7
+ data.tar.gz: bf033de278534736d0e8541581902d5e121e3ee311ba22aa16136c5c28f2ba8f7a7473d8b881588901861b5333ba64730b5834bab109e5af900578186814c15b
@@ -1,6 +1,41 @@
1
1
  class Trackvia
2
- def self.hi
3
- puts "Hello world!"
2
+ def initialize(account_id, api_key, table_id)
3
+ @account_id = account_id
4
+ @api_key = api_key
5
+ @table_id = table_id
6
+ @base_url = "https://secure.trackvia.com/app/api"
7
+ end
8
+
9
+ def pull_records(view_id)
10
+ action = "getview"
11
+ fmt = 'json'
12
+ params = {accountid: @account_id, apikey: @api_key, action: action, viewid: view_id, tableid: @table_id, format: fmt}
13
+ response = Curl.post(@base_url, params)
14
+ JSON.parse(response.body_str)
15
+ end
16
+
17
+ def update_record(record_id, data={})
18
+ action = "updaterecord"
19
+ fmt = 'json'
20
+ params = {accountid: @account_id, apikey: @api_key, action: action, tableid: @table_id, recordid: record_id, format: fmt, data: data.to_json}
21
+ response = Curl.post(@base_url, params)
22
+ JSON.parse(response.body_str)
23
+ end
24
+
25
+ def pull_record(record_id)
26
+ action = "getrecord"
27
+ fmt = 'json'
28
+ params = {accountid: @account_id, apikey: @api_key, action: action, tableid: @table_id, format: fmt, recordid: record_id}
29
+ response = Curl.post(@base_url, params)
30
+ JSON.parse(response.body_str)
31
+ end
32
+
33
+ def search(terms)
34
+ action = "getsearch"
35
+ fmt = 'json'
36
+ params = {accountid: @account_id, apikey: @api_key, action: action, tableid: @table_id, format: fmt, terms: terms}
37
+ response = Curl.post(@base_url, params)
38
+ JSON.parse(response.body_str)
4
39
  end
5
40
 
6
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackvia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Cottage