stockpot 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +91 -12
- data/lib/stockpot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 988e38a908f21076e0eb727da147dd47ce9bd8958265ee914f9a37445504dc79
|
4
|
+
data.tar.gz: 81c617349f3bdff403877c6b9cbca27802fe54d9a16382d18e6c75679f69de10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90c2d16c82aa6988a1e5e4cde8b166bee04db205c934eca52246a009cc7aacb52f81a29d7c86e875a4252efc330ce67c9f1b99b18d477ef549efb6a94686e747
|
7
|
+
data.tar.gz: 2cf43996d38975b6427eb19512dddf1e5f59824c8d490e75af3016d7fa6b0c7b2b6976f41124698151a857a2ef1c158a6e7951553187d780895ac2c49f958b9d
|
data/README.md
CHANGED
@@ -44,8 +44,9 @@ gem install stockpot
|
|
44
44
|
```
|
45
45
|
|
46
46
|
## Usage
|
47
|
+
---
|
47
48
|
|
48
|
-
|
49
|
+
## Rails App
|
49
50
|
|
50
51
|
Add the `Stockpot` engine to your `/config/routes.rb` file, changing the base path if you'd like to:
|
51
52
|
|
@@ -55,20 +56,98 @@ mount Stockpot::Engine, at: "/stockpot"`
|
|
55
56
|
|
56
57
|
This will give you the following [routes](/config/routes.rb) (assuming the default "/stockpot" path):
|
57
58
|
|
58
|
-
|
59
|
-
* GET - Query for data
|
60
|
-
* POST - Create new data
|
61
|
-
* DELETE - Remove data
|
62
|
-
* PUT - Update data
|
59
|
+
### `/stockpot/records`
|
63
60
|
|
64
|
-
|
65
|
-
* DELETE - Clears Rails & Redis caches and truncates Active Records databases.
|
61
|
+
#### GET
|
66
62
|
|
67
|
-
|
68
|
-
* GET - Query for data
|
69
|
-
* POST - Create new data
|
63
|
+
Query for data. Accepts a array of objects that require at least a model name, but can also include additional qualifying data.
|
70
64
|
|
71
|
-
|
65
|
+
```javascript
|
66
|
+
[
|
67
|
+
{ model: "user" },
|
68
|
+
{ model: "address" }
|
69
|
+
]
|
70
|
+
// or
|
71
|
+
[
|
72
|
+
{ model: "user", id: "foo"
|
73
|
+
]
|
74
|
+
```
|
75
|
+
|
76
|
+
#### POST
|
77
|
+
|
78
|
+
Create new data. Accepts an object specifying a single model with additional qualifiers.
|
79
|
+
|
80
|
+
* factory (required) - Specify which factory to create a record with.
|
81
|
+
* list (optional) - Specify a count of items to create, default: 1
|
82
|
+
* traits (optional) - An array of strings specifying any traits you may want to use with your data. Applies to all records created.
|
83
|
+
* attributes (optional) - An array of objects allowing for the specification of data to be used when creating records. Array position matches with list order if multiple records are desired.
|
84
|
+
|
85
|
+
```javascript
|
86
|
+
{
|
87
|
+
factory: "user",
|
88
|
+
traits: ["having_address"],
|
89
|
+
attributes: [{
|
90
|
+
email: "foo@bar.com",
|
91
|
+
password: "baz",
|
92
|
+
first_name: "Foo",
|
93
|
+
last_name: "Bar"
|
94
|
+
}]
|
95
|
+
}
|
96
|
+
```
|
97
|
+
|
98
|
+
#### DELETE
|
99
|
+
|
100
|
+
Remove data. Accepts the same type of input as GET
|
101
|
+
|
102
|
+
#### PUT
|
103
|
+
|
104
|
+
Update data Accepts an array of objects with each object specifying the model type to be updated along with the data to update. Input is uses the same base as GET and DELETE, but also accepts an `update` object allowing for the specification of the data to be updated.
|
105
|
+
|
106
|
+
```javascript
|
107
|
+
[
|
108
|
+
{
|
109
|
+
model: "user",
|
110
|
+
user_id: "123",
|
111
|
+
update: {
|
112
|
+
status: "active",
|
113
|
+
email: "foo@bar.com"
|
114
|
+
}
|
115
|
+
}
|
116
|
+
]
|
117
|
+
```
|
118
|
+
|
119
|
+
### `/stockpot/clean_database`
|
120
|
+
|
121
|
+
#### DELETE
|
122
|
+
|
123
|
+
Clears Rails & Redis caches and truncates Active Records databases. No body required.
|
124
|
+
|
125
|
+
### `/stockpot/redis`
|
126
|
+
|
127
|
+
#### GET
|
128
|
+
|
129
|
+
Query for data. Accepts key or field to use to search cache for record.
|
130
|
+
|
131
|
+
```javascript
|
132
|
+
{
|
133
|
+
key: "123",
|
134
|
+
field: "foo"
|
135
|
+
}
|
136
|
+
```
|
137
|
+
|
138
|
+
#### POST - Create new data
|
139
|
+
|
140
|
+
Accepts an object specifying a key, field, and value to be inserted into Redis cache.
|
141
|
+
|
142
|
+
```javascript
|
143
|
+
{
|
144
|
+
key: "123",
|
145
|
+
field: "foo",
|
146
|
+
value: "bar"
|
147
|
+
}
|
148
|
+
```
|
149
|
+
|
150
|
+
## Cypress/External Suite Examples
|
72
151
|
|
73
152
|
We utilize Cypress commands to abstract out helpers for setting up state such as
|
74
153
|
|
data/lib/stockpot/version.rb
CHANGED