StripePost v0.5.1 StripePost.Api View Source

Take several options, and an HTTP method and send the request to StripePost

The available options are comprised of those to helper generate the StripePost URL, to extract data for the request and authenticate your API call.

URL opts (to help create the resolved StripePost URL):

  • :base - The base URL which defaults to http://localhost:4000/v1
  • :resource - The requested resource (e.g. /domains)

Data opts (to send data along with the request)

  • :body - The encoded body of the request (typically provided in JSON)
  • :params - The query parameters of the request

Header opts (to send meta-data along with the request)

  • :api_key - Defaults to the test API key key-3ax6xnjp29jd6fds4gc373sgvjxteol0

Link to this section Summary

Functions

Issues an HTTP request with the given method to the given url_opts

Link to this section Functions

Issues an HTTP request with the given method to the given url_opts.

Args:

  • method - HTTP method as an atom (:get, :head, :post, :put, :delete, etc.)
  • opts - A keyword list of options to help create the URL, provide the body and/or query params

The options above can be defaulted using Mix.Config configurations, please refer to StripePost for more details on configuring this library.

This function returns {<status_code>, response} if the request is successful, and {:error, reason} otherwise.

Examples

StripePost.Api.request(:get, resource: "customers", bearer_auth: "sk_test_ABC123")
Link to this function

request(method, provided_opts, configured_opts) View Source