Code Monkey home page Code Monkey logo

jar's People

Contributors

jwietelmann avatar

Watchers

 avatar

jar's Issues

Handle unexpected 204 errors?

When using the address validation endpoint, I momentarily forgot to have my test POST any params. Instead of receiving any kind of error, I got a 204 No Content, which implies success. (This is something I'd consider a bug on TaxJar's end, but it would demand an API version bump if fixed, IMO.)

Anyway, my code's returning {:ok, _} in this case. But it's not okay! What actually happened was the API server more or less rejected the request for lack of appropriate params.

(Cursory testing suggests the problem is probably limited to /addresses/validate.)

Complete API coverage

I made notes of which sections of the API I originally skipped in the jar.ex file, with TODO: comments. Time to actually finish those up.

Add the option to use a global client configuration

Passing a client struct to each call is good because it makes the lib more flexible, but ideally there should also be a way to use a global configuration. Rather than refactor to make the client argument of API functions optional, I think it should suffice for now just to make something like this possible:

Jar.global() # instead of Jar.configure(options)
|> Jar.list_categories()
|> case do
   # ...
end

Test functions whose API endpoints are missing from the sandbox

They are:

  • Jar.list_customers/1
  • Jar.validate_address/2
  • Jar.validate_vat_number/2

They should probably get checked against the non-sandbox API at least once before everything in tests gets mocked (#1). Careful not to accidentally run the whole test suite against the live, non-sandbox API in the process.

Some level of pre-validation for params?

Related to #8 maybe.

It probably doesn't make sense to go overboard on pre-validating everything possible.

What probably does make sense: If the API endpoint requires params, the Elixir function's signature shouldn't have an optional params arg.`

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.