Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EndShipper beta class. #249

Merged
merged 2 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## CHANGELOG

## Next Release

- Adds the `EndShipper` Beta class with `save()`, `retrieve()`, and `all()` functions

## v5.1.0 (2022-05-09)

- Adds a `lowestRate()` function to Orders and Pickups
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/beta/easypost.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Referral, { propTypes as referralPropTypes } from './resources/referral';
import EndShipper from './resources/end_shipper';
jchen293 marked this conversation as resolved.
Show resolved Hide resolved

import API from '../easypost';

export const DEFAULT_BASE_URL = 'https://api.easypost.com/beta/';

export const RESOURCES = {
EndShipper,
Referral,
};

Expand Down
28 changes: 28 additions & 0 deletions src/beta/resources/end_shipper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import T from 'proptypes';
import base from '../../resources/base';

export const propTypes = {
jchen293 marked this conversation as resolved.
Show resolved Hide resolved
id: T.string,
object: T.string,
street1: T.string,
street2: T.string,
city: T.string,
state: T.string,
zip: T.string,
country: T.string,
name: T.string,
company: T.string,
phone: T.string,
email: T.string,
};

export default (api) =>
class EndShipper extends base(api) {
static _name = 'EndShipper';

static _url = 'end_shippers';

static key = 'address';

static propTypes = propTypes;
Justintime50 marked this conversation as resolved.
Show resolved Hide resolved
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{
"log": {
"_recordingName": "EndShipper Resource/creates an EndShipper object",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "fffa82203c7e21ee089783df3936f20c",
"_order": 0,
"cache": {},
"request": {
"bodySize": 216,
"cookies": [],
"headers": [
{
"name": "accept-encoding",
"value": "gzip,deflate,sdch,br"
},
{
"name": "accept",
"value": "application/json"
},
{
"name": "content-type",
"value": "application/json"
},
{
"name": "user-agent",
"value": "EasyPost/v2 NodejsClient/5.1.0 Nodejs/16.13.1"
},
{
"name": "x-easypost-client-user-agent",
"value": "{\"client_version\":\"5.1.0\",\"lang\":\"nodejs\",\"lang_version\":\"v16.13.1\",\"publisher\":\"easypost\",\"platform\":\"darwin\"}"
},
{
"name": "content-length",
"value": 216
},
{
"name": "host",
"value": "api.easypost.com"
}
],
"headersSize": 507,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"address\":{\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"phone\":\"5555555555\",\"email\":\"test@example.com\"}}"
},
"queryString": [],
"url": "https://api.easypost.com/beta/end_shippers"
},
"response": {
"bodySize": 368,
"content": {
"encoding": "base64",
"mimeType": "application/json; charset=utf-8",
"size": 368,
"text": "[\"H4sIAAAAAAAAA4yOPW/DIBCG/wpibVMBwTb1FOS6Uj9iW4YqzRRhgxRXtY0cMrRV/3uPDJl7E/fw3L33gweLc+xOh8SILLUdZ2bNubWd6bIuSYWgxHBj+hTf4rn7cH0AvZysOg7euwVovzgTnD2Y+MMIYyuSrGiqqciTLOf0hpCcEBDP3v5PnMzoQHmWxQtSjWzbehdz5tGb6SvGS7VvaqUBnsLiXKAA10IgXe8qVVYPSGkkG40YuSoMlLhkCHGDkhV6bGVVPKmivjhwGfBCQvM9eHjec0oyOC8jl+zzFJY4+aag9cd5inpyLYBuNMMnQF0qvSnf5bZ5Le+Keot//wAAAP//AwDcMjBKZQEAAA==\"]"
},
"cookies": [],
"headers": [
{
"name": "x-frame-options",
"value": "SAMEORIGIN"
},
{
"name": "x-xss-protection",
"value": "1; mode=block"
},
{
"name": "x-content-type-options",
"value": "nosniff"
},
{
"name": "x-download-options",
"value": "noopen"
},
{
"name": "x-permitted-cross-domain-policies",
"value": "none"
},
{
"name": "referrer-policy",
"value": "strict-origin-when-cross-origin"
},
{
"name": "x-ep-request-uuid",
"value": "e405397f62829ea5ff14956b00037a30"
},
{
"name": "cache-control",
"value": "no-cache, no-store"
},
{
"name": "pragma",
"value": "no-cache"
},
{
"name": "expires",
"value": "0"
},
{
"name": "content-type",
"value": "application/json; charset=utf-8"
},
{
"name": "etag",
"value": "W/\"fa2ab302586ea713c50b30c8ce1a7c1e\""
},
{
"name": "x-runtime",
"value": "0.054254"
},
{
"name": "content-encoding",
"value": "gzip"
},
{
"name": "transfer-encoding",
"value": "chunked"
},
{
"name": "x-node",
"value": "bigweb2nuq"
},
{
"name": "x-version-label",
"value": "easypost-202205131956-9146889ba0-master"
},
{
"name": "x-backend",
"value": "easypost"
},
{
"name": "x-proxied",
"value": "intlb2nuq 570dfcbc0a, intlb1wdc 570dfcbc0a, extlb1wdc c51cdb8bf2"
},
{
"name": "strict-transport-security",
"value": "max-age=31536000; includeSubDomains; preload"
},
{
"name": "connection",
"value": "close"
}
],
"headersSize": 766,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 201,
"statusText": "Created"
},
"startedDateTime": "2022-05-16T18:57:40.910Z",
"time": 247,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 247
}
}
],
"pages": [],
"version": "1.2"
}
}