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

Fix upload file api #334

Merged
merged 3 commits into from
Apr 11, 2018
Merged

Conversation

chubarovNick
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Jan 19, 2018

Coverage Status

Coverage increased (+0.4%) to 79.688% when pulling 9dfadfe on chubarovNick:fix/file_uploads into ec5d74b on code-corps:2.0-beta.

Copy link
Contributor

@mjadczak mjadczak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I like the separate perform_request function.

Copy link
Contributor

@begedin begedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Good work on drying ti up as well.

Copy link
Contributor

@begedin begedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual changes look good to merge. What's needed is a correction of a couple of miner formatting issues and then we're good to go.

@@ -65,6 +65,11 @@ defmodule Stripe.Util do
module |> Atom.to_string() |> String.trim_leading("Elixir.")
end

def multipart_key(:file),do: :file
def multipart_key(key) when is_atom(key),do: Atom.to_string(key)
def multipart_key(key),do: key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some formatting issues here

,do needs to be , do

{ Stripe.Util.multipart_key(key), value}
end)

perform_request(req_url, :post, {:multipart, parts}, headers, opts )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You got an extra space at the end here. opts ) -> opts)

|> add_auth_header(api_key)
|> add_connect_header(connect_account_id)
|> Map.to_list()
perform_request(req_url, method, req_body, headers, opts )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space here. opts ) -> opts)

def multipart_key(key) when is_atom(key),do: Atom.to_string(key)
def multipart_key(key),do: key


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove one of these blank lines here.

parts =
body
|> Enum.map(fn({key, value})->
{ Stripe.Util.multipart_key(key), value}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space here: { Stripe.Util.multipart_key(key), value}-> {Stripe.Util.multipart_key(key), value}


@http_module.request(method, req_url, req_headers, req_body, req_opts)
|> handle_response()
perform_request(req_url, method, req_body, headers, opts )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opts ) -> opts)

@chubarovNick
Copy link
Contributor Author

@begedin Formatting applied 👍

.gitignore Outdated
@@ -6,6 +6,8 @@ config/config.secret.exs
/doc
.DS_Store

#elixir LS files
/.elixir_ls
# IntelliJ IDEA files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this on the first passthrough, but more formatting issues here

  • there should be a space in the comment: #elixir LS files -> # elixir LS files
  • there should be a blank line between lines 10 and 11

@chubarovNick
Copy link
Contributor Author

@begedin All formatting issues was addressed 👍

@begedin begedin merged commit fc7fb73 into beam-community:2.0-beta Apr 11, 2018
@begedin
Copy link
Contributor

begedin commented Apr 11, 2018

@chubarovNick Sorry for the delay on this. Merged. Thank you for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants