diff options
Diffstat (limited to 'sicepat.c')
-rw-r--r-- | sicepat.c | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -3,6 +3,8 @@ #include "private.h" #define BASE "http://api.sicepat.com/customer/" +#define ORIGINS "origin" +#define DESTINATIONS "destination" const char **sicepat_init(char *provisions[]) { @@ -20,6 +22,46 @@ const char **sicepat_init(char *provisions[]) return fields; } +const char **sicepat_origins() +{ + struct shipping *shipping = shipping_list[PIKUL_SICEPAT]; + shipping->url = malloc(strlen(BASE) + strlen(ORIGINS) + 1); + sprintf(shipping->url, "%s%s", BASE, ORIGINS); + static const char *trail[] = { + "sicepat", + "results", + NULL + }; + shipping->trail = trail; + static const char *attributes[] = { + "origin_code", + NULL, + "origin_name", + NULL + }; + return attributes; +} + +const char **sicepat_destinations() +{ + struct shipping *shipping = shipping_list[PIKUL_SICEPAT]; + shipping->url = malloc(strlen(BASE) + strlen(DESTINATIONS) + 1); + sprintf(shipping->url, "%s%s", BASE, DESTINATIONS); + static const char *trail[] = { + "sicepat", + "results", + NULL + }; + shipping->trail = trail; + static const char *attributes[] = { + "destination_code", + "subdistrict", + "city", + "province" + }; + return attributes; +} + const char **sicepat_services(const char *origin, const char *destination, double weight) { struct shipping *shipping = shipping_list[PIKUL_SICEPAT]; |