trackvia 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackvia.rb +37 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c77a1c53d03105686c18ce90ce69bf69d8939821
|
4
|
+
data.tar.gz: dd8a630f9988743edcc5d123a8627d1b2655f2f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a59e2f638223f370c7259666a3d802c39be764bd5f8eba3eb29c55959ce6e01fac3e398c3eb38c79844dda223b9c2607651520177600fac05be5ec5706169136
|
7
|
+
data.tar.gz: bf033de278534736d0e8541581902d5e121e3ee311ba22aa16136c5c28f2ba8f7a7473d8b881588901861b5333ba64730b5834bab109e5af900578186814c15b
|
data/lib/trackvia.rb
CHANGED
@@ -1,6 +1,41 @@
|
|
1
1
|
class Trackvia
|
2
|
-
def
|
3
|
-
|
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
|