form_stalker 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +70 -5
- data/lib/form_stalker/data/check_logic.rb +1 -1
- data/lib/form_stalker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c9e6082066146895626125b4282d9bb90aaa21
|
4
|
+
data.tar.gz: bfe54fbab6ef59301179bfd73c3729173302b468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fef77d58422c9853be86d8498a535e649ef8875a3ee957e20bbe62410251a3e24bb4d9f3c92731c0133123f23c97f2ee69ad1cddb371c33d374110dbfd3464c
|
7
|
+
data.tar.gz: 0c882abd9a2e6f5ee9527c84bdb361f9fdbf5229928da050e5e7bbf2ded9afe7676f8f5761777bd11c3bac19fbb11a7ae409348cc4b4172284fedd819737b48f
|
data/README.md
CHANGED
@@ -20,16 +20,81 @@ Make requests to FormStack and receive a sanitized response
|
|
20
20
|
```ruby
|
21
21
|
response = FormStalker.form(1)
|
22
22
|
|
23
|
-
# don't trust (response.status == :ok) because Formstack API does not respect the HTTP
|
23
|
+
# don't trust (response.status == :ok) because Formstack API does not respect the HTTP status codes
|
24
24
|
if response.ok?
|
25
|
-
form_data = response.data
|
25
|
+
form_data = response.data # returns a FormStalker::Data::Form instance
|
26
26
|
else
|
27
|
-
response.status #
|
28
|
-
response.error #
|
27
|
+
response.status # returns a symbol representing FormStack's HTTP status
|
28
|
+
response.error # returns a message string explaining the error
|
29
29
|
end
|
30
30
|
```
|
31
31
|
|
32
|
-
## 2)
|
32
|
+
## 2) FormStalker.form
|
33
|
+
```ruby
|
34
|
+
response = FormStalker.form(1)
|
35
|
+
|
36
|
+
raise response.error unless response.ok?
|
37
|
+
|
38
|
+
form_data = response.data
|
39
|
+
|
40
|
+
form_data.id # returns an integer
|
41
|
+
form_data.created # returns a date
|
42
|
+
form_data.deleted # returns a boolean
|
43
|
+
form_data.fields # returns an array of FormStalker::Data::FormField instances
|
44
|
+
# etc.
|
45
|
+
form_data.attributes # returns a Hash with all of its data
|
46
|
+
|
47
|
+
# and the one your are probably looking for
|
48
|
+
form_data.logic # returns an instance of FormStalker::Data::FormFieldsLogic
|
49
|
+
|
50
|
+
form_data.logic.logic_field_ids # returns an array of field ids that have logic
|
51
|
+
form_data.logic.calc_field_ids # returns an array of field ids
|
52
|
+
|
53
|
+
form_data.logic.checks # returns an array of Hashes with the actual logic
|
54
|
+
|
55
|
+
# Example of what can be inside the #checks
|
56
|
+
[
|
57
|
+
{
|
58
|
+
target: 37314714,
|
59
|
+
action: 'Show',
|
60
|
+
bool: 'AND',
|
61
|
+
fields: [41111633],
|
62
|
+
checks: [{ field: 41111633, condition: '==', option: 'Option1' }]
|
63
|
+
},
|
64
|
+
{
|
65
|
+
target: 40952921,
|
66
|
+
action: 'Show',
|
67
|
+
bool: 'AND',
|
68
|
+
fields: [37314736],
|
69
|
+
checks: [{ field: 37314736, condition: '!=', option: 'Option1' }]
|
70
|
+
}
|
71
|
+
{
|
72
|
+
target: 37314784,
|
73
|
+
action: 'Show',
|
74
|
+
bool: 'AND',
|
75
|
+
fields: [37314745],
|
76
|
+
checks: [{ field: 37314745, condition: '==', option: '0' }]
|
77
|
+
}
|
78
|
+
]
|
79
|
+
```
|
80
|
+
|
81
|
+
## 2) FormStalker.form_fields
|
82
|
+
```ruby
|
83
|
+
response = FormStalker.form_fields(1)
|
84
|
+
|
85
|
+
raise response.error unless response.ok?
|
86
|
+
|
87
|
+
form_fields = response.data # returns an array of FormStalker::Data::FormField instances
|
88
|
+
|
89
|
+
form_fields.each do |form_fields_data|
|
90
|
+
form_fields_data.id # returns an integer
|
91
|
+
form_fields_data.required # returns an boolean
|
92
|
+
# etc.
|
93
|
+
form_fields_data.attributes # returns a Hash with all of its data
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
## 4) Instalation
|
33
98
|
|
34
99
|
Add this to your Gemfile:
|
35
100
|
```
|
data/lib/form_stalker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: form_stalker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- StreetBees Dev Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vcr
|