Skip to content

Commit c3e3ebf

Browse files
committed
Make changes according to review
1 parent baadb0f commit c3e3ebf

File tree

4 files changed

+13
-42
lines changed

4 files changed

+13
-42
lines changed

README.md

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ void setup() {
3737
byte ip[] = { 192, 168, 0, 10 };
3838
byte gateway[] = { 192, 168, 0, 1 };
3939
byte subnet[] = { 255, 255, 255, 0 };
40-
byte dnxs[] = { 8, 8, 8, 8 };
41-
Ethernet.begin(mac, ip, dnxs, gateway, subnet);
40+
byte dns[] = { 8, 8, 8, 8 };
41+
Ethernet.begin(mac, ip, dns, gateway, subnet);
4242
}
4343

4444
// Send an indexation command to Slicing Dice API and print the result
@@ -75,24 +75,11 @@ Whether you want to test the client installation or simply check more examples o
7575

7676
### Constructors
7777

78-
`SlicingDice(const char* apiKey, boolean production)`
78+
`SlicingDice(const char* apiKey, boolean production, const char* host, int port)`
7979
* `apiKey (const char*)` - [API key](http://panel.slicingdice.com/docs/#api-details-api-connection-api-keys) to authenticate requests with the SlicingDice API.
80-
* `production(boolean)` - If true the client will send requests to production end-point, otherwise to tests end-point.
81-
82-
`SlicingDice(const char* apiKey, const char* host)`
83-
* `apiKey (const char*)` - [API key](http://panel.slicingdice.com/docs/#api-details-api-connection-api-keys) to authenticate requests with the SlicingDice API.
84-
* `host (const char*)` - [Connection endpoint](http://panel.slicingdice.com/docs/#api-details-api-connection-connection-endpoints) to use when generating requests to SlicingDice.
85-
86-
`SlicingDice(const char* apiKey, const char* host, int port)`
87-
* `apiKey (const char*)` - [API key](http://panel.slicingdice.com/docs/#api-details-api-connection-api-keys) to authenticate requests with the SlicingDice API.
88-
* `host (const char*)` - [Connection endpoint](http://panel.slicingdice.com/docs/#api-details-api-connection-connection-endpoints) to use when generating requests to SlicingDice.
89-
* `port (int)` - Port to connect to when generating requests. Particularly useful when connect to `http://localhost`.
90-
91-
`SlicingDice(const char* apiKey, const char* host, int port, boolean production)`
92-
* `apiKey (const char*)` - [API key](http://panel.slicingdice.com/docs/#api-details-api-connection-api-keys) to authenticate requests with the SlicingDice API.
93-
* `host (const char*)` - [Connection endpoint](http://panel.slicingdice.com/docs/#api-details-api-connection-connection-endpoints) to use when generating requests to SlicingDice.
94-
* `port (int)` - Port to connect to when generating requests. Particularly useful when connect to `http://localhost`.
95-
* `production(boolean)` - If true the client will send requests to production end-point, otherwise to tests end-point.
80+
* `production(boolean)` - (Default: true) If true the client will send requests to production end-point, otherwise to tests end-point.
81+
* `host (const char*)` - (Default: api.slicingdice.com) [Connection endpoint](http://panel.slicingdice.com/docs/#api-details-api-connection-connection-endpoints) to use when generating requests to SlicingDice.
82+
* `port (int)` - (Default: 80) Port to connect to when generating requests. Particularly useful when connect to `http://localhost`.
9683

9784
### `void index(JsonObject& query)`
9885
Index data to existing entities or create new entities, if necessary. This method corresponds to a [POST request at /index](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-index).
@@ -120,8 +107,8 @@ void setup() {
120107
byte ip[] = { 192, 168, 0, 10 };
121108
byte gateway[] = { 192, 168, 0, 1 };
122109
byte subnet[] = { 255, 255, 255, 0 };
123-
byte dnxs[] = { 8, 8, 8, 8 };
124-
Ethernet.begin(mac, ip, dnxs, gateway, subnet);
110+
byte dns[] = { 8, 8, 8, 8 };
111+
Ethernet.begin(mac, ip, dns, gateway, subnet);
125112
}
126113

127114
// Send an indexation command to Slicing Dice API and print the result

SlicingDice.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
#include "SlicingDice.h"
22

3-
4-
SlicingDice::SlicingDice(String apiUserKey, boolean production) {
5-
construct(apiUserKey, "api.slicingdice.com", 80, production);
6-
}
7-
8-
SlicingDice::SlicingDice(String apiUserKey, const char* customHost) {
9-
construct(apiUserKey, customHost, 80, true);
10-
}
11-
12-
SlicingDice::SlicingDice(String apiUserKey, const char* customHost, int customPort) {
13-
construct(apiUserKey, customHost, customPort, true);
14-
}
15-
16-
SlicingDice::SlicingDice(String apiUserKey, const char* customHost, int customPort, boolean production) {
17-
construct(apiUserKey, customHost, customPort, production);
3+
SlicingDice::SlicingDice(String apiUserKey, boolean useProduction, const char* customHost, int customPort) {
4+
construct(apiUserKey, customHost, customPort, useProduction);
185
}
196

207
void SlicingDice::construct(String apiUserKey, const char* customHost, int customPort, boolean production) {

SlicingDice.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
class SlicingDice {
88

99
public:
10-
SlicingDice(String apiUserKey, boolean production);
11-
SlicingDice(String apiUserKey, const char* customHost);
12-
SlicingDice(String apiUserKey, const char* customHost, int customPort);
13-
SlicingDice(String apiUserKey, const char* customHost, int customPort, boolean production);
10+
SlicingDice(String apiUserKey, boolean useProduction = false, const char* customHost = "api.slicingdice.com", int customPort=80);
1411

1512
void index(JsonObject& query);
1613
int statusCode;

tests_and_examples/Simple.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ void setup() {
1818
byte ip[] = { 192, 168, 0, 10 };
1919
byte gateway[] = { 192, 168, 0, 1 };
2020
byte subnet[] = { 255, 255, 255, 0 };
21-
byte dnxs[] = { 8, 8, 8, 8 };
22-
Ethernet.begin(mac, ip, dnxs, gateway, subnet);
21+
byte dns[] = { 8, 8, 8, 8 };
22+
Ethernet.begin(mac, ip, dns, gateway, subnet);
2323
}
2424

2525
// Send an indexation command to Slicing Dice API and print the result

0 commit comments

Comments
 (0)