Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Iugu

The class for interaction with IUGU.

Should be constructed passing the API token as parameter (see https://dev.iugu.com/v1.0/reference#autentica%C3%A7%C3%A3o)

Hierarchy

  • Iugu

Index

Constructors

constructor

  • new Iugu(apiToken?: undefined | string, accountId?: undefined | string): Iugu
  • Initializes the API interaction instance

    Parameters

    • Optional apiToken: undefined | string

      the API token created for your account. If not passed, it will be read from the environment variable IUGU_TOKEN

    • Optional accountId: undefined | string

      the IUGU account ID

    Returns Iugu

Properties

Private _accountID

_accountID: string

Private customerInstance

customerInstance: CustomerAPI

Private paymentTokenInstance

paymentTokenInstance: PaymentTokenAPI

Private planInstance

planInstance: PlanAPI

Private subscriptionInstance

subscriptionInstance: SubscriptionAPI

Private token

token: string

Accessors

accountID

  • get accountID(): string
  • set accountID(v: string): void
  • Returns the account ID

    since

    0.2.1

    Returns string

  • Sets the account ID. Needed only for payment token creation.

    since

    0.2.1

    Parameters

    • v: string

    Returns void

apiToken

  • get apiToken(): string
  • Returns the current instance API token

    Returns string

customer

paymentToken

plan

subscription

Methods

getAuthorizationHeader

  • getAuthorizationHeader(): string
  • Returns the string to be set to the Authorization header

    Output format: "Basic (base64 encoded string: {API token} + ':')"

    Returns string

makePagedRequest

  • makePagedRequest<OutType, InType>(method: string, endpoint: string, limit?: number, headers?: any): PagedRequest<InType, OutType>
  • Creates a new PagedRequest, setting to API url and the authorization header

    example

    iugu.makePagedRequest('GET', '/customers')

    Type parameters

    • OutType

    • InType

    Parameters

    • method: string

      The HTTP method to be used

    • endpoint: string

      The API endpoint, with the preceeding slash

    • Default value limit: number = 100
    • Default value headers: any = null

    Returns PagedRequest<InType, OutType>

makeRequest

  • makeRequest<OutType, InType>(method: string, endpoint: string, headers?: any): Request<InType, OutType>
  • Creates a new Request, setting to API url and the authorization header

    example

    iugu.makeRequest('GET', '/customers')

    Type parameters

    • OutType

    • InType

    Parameters

    • method: string

      The HTTP method to be used

    • endpoint: string

      The API endpoint, with the preceeding slash

    • Default value headers: any = null

    Returns Request<InType, OutType>

Generated using TypeDoc