diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-18 21:37:32 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-18 21:37:32 +0800 |
commit | b12fc8fbf21b44825dfd9f0afa43ea54900d32de (patch) | |
tree | 48fc0d875abcd12840dae4aeb0fcaecc2c5c1386 /sicepat.c | |
parent | 1161463fce40f2e5b59ef6dd7406aa0a55f8d936 (diff) |
Conform to updated interfaces
Diffstat (limited to 'sicepat.c')
-rw-r--r-- | sicepat.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -1,6 +1,8 @@ #include "shipping.h" #include "handler.h" +#define BASE "http://api.sicepat.com/customer/" + extern CURL *curl; static const char *status_trail[] = { @@ -10,20 +12,18 @@ static const char *status_trail[] = { NULL }; -void sicepat_init(char *provisions[], struct shipping *shipping) +void sicepat_init(char *provisions[]) { - static const char *url = "http://api.sicepat.com/customer/"; - shipping->base = malloc(strlen(url) + 1); - strcpy(shipping->base, url); - headers((const char *[]){ "api-key", NULL }, provisions, shipping); + shipping.base = malloc(strlen(BASE) + 1); + strcpy(shipping.base, BASE); + headers((const char *[]){ "api-key", NULL }, provisions); } -void sicepat_services(const char *origin, const char *destination, double weight, - struct shipping *shipping, char **url) +void sicepat_services(const char *origin, const char *destination, double weight, char **url) { - *url = malloc(strlen(shipping->base) + strlen("tariff?origin=") + strlen(origin) + *url = malloc(strlen(shipping.base) + strlen("tariff?origin=") + strlen(origin) + strlen("&destination=") + strlen(destination) + strlen("&weight=") + 9); - sprintf(*url, "%stariff?origin=%s&destination=%s&weight=%f", shipping->base, + sprintf(*url, "%stariff?origin=%s&destination=%s&weight=%f", shipping.base, origin, destination, weight); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); } @@ -32,7 +32,7 @@ size_t sicepat_services_handle(const char *contents, size_t size, size_t nmemb, struct pikul_services **services) { size_t realsize = size * nmemb; - handle_services(contents, realsize, status_trail, (const char *[]){ + handle(SERVICES, contents, realsize, status_trail, (const char *[]){ "sicepat", "results", NULL |