Code Monkey home page Code Monkey logo

post-easy's Introduction

Post Easy

Clojure client for the EasyPost web service

very much a WIP

Usage

(def origin-adr
  {:address
   {:name "Steve Brule"
    :street1 "1849 Geary Blvd"
    :street2 "Apt C"
    :city "San Francisco"
    :state "NY"
    :zip "94115"
    :country "US"
    :phone "4155555555"}})

(def destination-adr
  {:address
   {:name "bushwald"
    :street1 "16 Arcade"
    :city "Nashville"
    :state "TN"
    :zip "37219"
    :country "US"
    :phone "7185555555"}
   :verify true})

(def prcl
  {:parcel
   {:length 4
    :width 4
    :height 6.2
    :weight 32}})

(def shpmnt {:to_address (:address origin-adr)
             :from_address (:address destination-adr)
             :parcel (:parcel prcl)})

(def token "EZ299nnTK2ffkdsefjlsiejfake_tokenR1piAarlSa6vA234RsA")

(def ep-shpmnt (create-shipment {:shipment shpmnt} token))

(def one-call-buy-shpmnt
  {:shipment (merge shpmnt
                    {:service "Priority"
                     :carrier_accounts ["ca_e61a814d26testa90b663a5zz053d18"]})})

(:postage_label (buy-shipment one-call-buy-shpmnt token))

(:postage_label (buy-shipment {:rate (get-lowest-rate (:rates ep-shpmnt))} token))

FIXME: write usage documentation!

Run the project's tests (they'll fail until you edit them):

$ clojure -T:build test

Run the project's CI pipeline and build a JAR (this will fail until you edit the tests to pass):

$ clojure -T:build ci

This will produce an updated pom.xml file with synchronized dependencies inside the META-INF directory inside target/classes and the JAR in target. You can update the version (and SCM tag) information in generated pom.xml by updating build.clj.

Install it locally (requires the ci task be run first):

$ clojure -T:build install

I used CLJ-New to generate the basic project scaffold. Check it out.

License

Copyright © 2022 Bradley Allen

Distributed under the Eclipse Public License version 1.0.

post-easy's People

Contributors

bushwald avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.