Skip to content

Commit

Permalink
Cleanup README (#783)
Browse files Browse the repository at this point in the history
* Cleanup README

close #780

* Make request_id a string instead of tuple (#763)

The request_id in Stripe.Error was being set to a tuple that
represented the "Request-Id" header. Now it will instead be a String
like described in the typespec.

---------

Co-authored-by: Matt McCoy <mattnenterprise@yahoo.com>
  • Loading branch information
snewcomer and mattnenterprise committed Feb 17, 2023
1 parent 017d7ec commit 525e96a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An Elixir library for working with [Stripe](https://stripe.com/).

## 2.x.x status

[![Hex Docs](https://img.shields.io/badge/hex-docs-9768d1.svg)](https://hexdocs.pm/stripity_stripe) [![Inline docs](http://inch-ci.org/github/beam-community/stripe-elixir.svg?branch=master)](http://inch-ci.org/github/beam-community/stripe-elixir?branch=master) [![Coverage Status](https://coveralls.io/repos/github/beam-community/stripe-elixir/badge.svg?branch=master)](https://coveralls.io/github/beam-community/stripe-elixir?branch=master)
[![Hex Docs](https://img.shields.io/badge/hex-docs-9768d1.svg)](https://hexdocs.pm/stripity_stripe) [![Inline docs](http://inch-ci.org/github/beam-community/stripity_stripe.svg?branch=master)](http://inch-ci.org/github/beam-community/stripity_stripe?branch=master) [![Coverage Status](https://coveralls.io/repos/github/beam-community/stripity_stripe/badge.svg?branch=master)](https://coveralls.io/github/beam-community/stripity_stripe?branch=master)

# Which version should I use?

Expand Down Expand Up @@ -38,7 +38,7 @@ Install the dependency by version:
Or by commit reference:

```elixir
{:stripity_stripe, git: "https://github.com/code-corps/stripity_stripe", ref: "8c091d4278d29a917bacef7bb2f0606317fcc025"}
{:stripity_stripe, git: "https://github.com/beam-community/stripity_stripe", ref: "017d7ecdb5aeadccc03986c02396791079178ba2"}
```

Next, add to your applications:
Expand Down Expand Up @@ -409,7 +409,3 @@ Why another Stripe Library? Currently there are a number of them in the Elixir w
- function calls that returned a standard `{:ok, result}` or `{:error, message}` response

As I began digging things up with these other libraries it became rather apparent that I was not only tweaking the API, but also ripping out a lot of the existing code... and that usually means I should probably do my own thing. So I did.

## Update

As of October 18th, Rob has graciously handed over the reins to the teams at [Code Corps](https://www.codecorps.org/) and [Strumber](https://strumber.com/). To address the concerns Rob mentioned above and update the high level api to work with all of the Stripe API Endpoints, they have since worked to release stripity_stripe 2.0, which is now the actively developed line of releases.
6 changes: 5 additions & 1 deletion lib/stripe/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,11 @@ defmodule Stripe.API do
end

defp handle_response({:ok, status, headers, body}) when status >= 300 and status <= 599 do
request_id = headers |> List.keyfind("Request-Id", 0)
request_id =
Enum.find_value(headers, fn
{"Request-Id", request_id} -> request_id
_header -> nil
end)

error =
case json_library().decode(body) do
Expand Down
4 changes: 4 additions & 0 deletions test/stripe/api_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ defmodule Stripe.APITest do
Stripe.API.request(%{}, :get, "/", %{}, [])
end

test "request_id is a string" do
{:error, %Stripe.Error{request_id: "req_123"}} = Stripe.API.request(%{}, :get, "/", %{}, [])
end

test "oauth_request works" do
verify_on_exit!()

Expand Down

0 comments on commit 525e96a

Please sign in to comment.