RazorpayEx.Request (razorpay_ex v0.1.3)

Copy Markdown View Source

Request module for making HTTP requests to Razorpay API.

This is the core HTTP client, similar to Ruby SDK's Request class.

Summary

Functions

Lists all entities with optional filters.

Fetches an entity by ID.

Makes a GET request to a specific URL.

Patches an entity (partial update).

Makes a POST request to a specific URL.

Makes a raw HTTP request to Razorpay API.

Makes a request and parses the response.

Types

http_method()

@type http_method() :: :get | :post | :put | :patch | :delete

response()

@type response() :: {:ok, map() | list()} | {:error, RazorpayEx.Error.t()}

Functions

all(resource_type, params \\ %{}, opts \\ [])

@spec all(atom(), map(), keyword()) :: response()

Lists all entities with optional filters.

Similar to Ruby SDK's Request#all method.

create(resource_type, data, opts \\ [])

@spec create(atom(), map(), keyword()) :: response()

Creates a new entity.

Similar to Ruby SDK's Request#create method.

delete(resource_type, id, opts \\ [])

@spec delete(atom(), String.t(), keyword()) :: response()

Deletes an entity.

Similar to Ruby SDK's Request#delete method.

fetch(resource_type, id, opts \\ [])

@spec fetch(atom(), String.t(), keyword()) :: response()

Fetches an entity by ID.

Similar to Ruby SDK's Request#fetch method.

get_url(resource_type, url, data \\ %{}, opts \\ [])

@spec get_url(atom(), String.t(), map(), keyword()) :: response()

Makes a GET request to a specific URL.

Similar to Ruby SDK's Request#get method.

patch(resource_type, id, data, opts \\ [])

@spec patch(atom(), String.t(), map(), keyword()) :: response()

Patches an entity (partial update).

Similar to Ruby SDK's Request#patch method.

post_url(resource_type, url, data \\ %{}, opts \\ [])

@spec post_url(atom(), String.t(), map(), keyword()) :: response()

Makes a POST request to a specific URL.

Similar to Ruby SDK's Request#post method.

raw_request(method, path, data \\ %{}, opts \\ [])

@spec raw_request(http_method(), String.t(), map(), keyword()) ::
  {:ok, HTTPoison.Response.t()} | {:error, RazorpayEx.Error.t()}

Makes a raw HTTP request to Razorpay API.

Similar to Ruby SDK's Request#raw_request method.

request(method, path, data \\ %{}, opts \\ [])

@spec request(http_method(), String.t(), map(), keyword()) :: response()

Makes a request and parses the response.

Similar to Ruby SDK's Request#request method.

update(resource_type, id, data, opts \\ [])

@spec update(atom(), String.t(), map(), keyword()) :: response()

Updates an entity.

Similar to Ruby SDK's Request#put method.