Module: ShipEngine::Constants

Defined in:
lib/shipengine/constants.rb

Defined Under Namespace

Modules: Country Classes: Addresses, Batches, Carriers, CarriersAccounts, Labels, Manifests, NamespaceV1, PackagePickups, PackageTypes, Paths, Rates, ServicePoints, Shipments, Shipsurance, Tags, Tokens, Tracking, Warehouses, Webhooks

Constant Summary collapse

API_KEY =
ENV.fetch("API_KEY", "")
PROD_URL =
"https://api.shipengine.com"
PATHS =
Paths.new(
  v1: NamespaceV1.new(
    addresses: Addresses.new(
      parse_address: "/v1/addresses/recognize",
      validate_address: "/v1/addresses/validate",
    ),
    batches: Batches.new(
      root: "/v1/batches",
      batch_by_external_id: "/v1/batches/external_batch_id",
    ),
    carriers_accounts: CarriersAccounts.new(
      root: "/v1/connections/carriers",
    ),
    carriers: Carriers.new(
      root: "/v1/carriers",
    ),
    shipsurance: Shipsurance.new(
      root: "/v1/connections/insurance/shipsurance",
      add_funds: "/v1/insurance/shipsurance/add_funds",
      balance: "/v1/insurance/shipsurance/balance",
    ),
    labels: Labels.new(
      root: "/v1/labels",
      label_by_external_shipment_id: "/v1/labels/external_shipment_id",
      purchase_label_with_rate_id: "/v1/labels/rates",
      purchase_label_with_shipment_id: "/v1/labels/shipment",
    ),
    manifests: Manifests.new(
      root: "/v1/manifests",
      manifest_request: "/v1/manifests/requests",
    ),
    package_pickups: PackagePickups.new(
      root: "/v1/pickups",
    ),
    package_types: PackageTypes.new(
      root: "/v1/packages",
    ),
    rates: Rates.new(
      root: "/v1/rates",
    ),
    service_points: ServicePoints.new(
      root: "/v1/service_points",
    ),
    shipments: Shipments.new(
      root: "/v1/shipments",
      shipment_by_external_id: "/v1/shipments/external_shipment_id",
      parse_shipping_info: "/v1/shipments/recognize",
    ),
    tags: Tags.new(
      root: "/v1/tags",
    ),
    tokens: Tokens.new(
      root: "/v1/tokens/ephemeral",
    ),
    tracking: Tracking.new(
      root: "/v1/tracking",
    ),
    warehouses: Warehouses.new(
      root: "/v1/warehouses",
    ),
    webhooks: Webhooks.new(
      root: "/v1/environment/webhooks",
    )
  )
)
RETRIES =
1
TIMEOUT =
30_000
PAGE_SIZE =
50
VALID_ISO_STRING =

Regex pattern to match a valid ISO-8601 string with timezone.

/^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$/.freeze
VALID_ISO_STRING_WITH_NO_TZ =

Regex pattern to match a valid ISO-8601 string with no timezone.

/^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?([+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$/.freeze