Lokalise APIv2 Ruby SDK

Ruby interface for the Lokalise APIv2 that represents returned data as Ruby objects.

View the Project on GitHub lokalise/ruby-lokalise-api




Payment cards

Fetch payment cards

Doc

@client.payment_cards(params = {})    # Input:
                                      ## params (hash)
                                      ### :page and :limit
                                      # Output:
                                      ## Collection of payment cards under the `payment_cards` attribute

For example:

cards = @client.payment_cards limit: 3, page: 1

cards[0].last4 # => '1234'

Fetch a single payment card

Doc

@client.payment_card(card_id)     # Input:
                                  ## card_id (string, required)
                                  # Output:
                                  ## A single payment card

For example:

card_id = '6789'

card = @client.payment_card card_id

card.last4 # => '1234'
card.brand # => 'Visa'

Create a payment card

Doc

@client.create_payment_card(params)   # Input:
                                      ## params (hash, required)
                                      ### number (integer, string, required) - card number
                                      ### cvc (integer, required) - 3-digit card CVV (CVC)
                                      ### exp_month (integer, required) - card expiration month (1 - 12)
                                      ### exp_year (integer, required) - card expiration year (for example, 2019)
                                      # Output:
                                      ## A newly created payment card

For example:

params = {
  number: '4242424242424242',
  cvc: '123',
  exp_month: '12',
  exp_year: '2020'
}

card = @client.create_payment_card params

card.last4 # => '4242'
card.brand # => 'Visa'

Delete a payment card

Doc

@client.destroy_payment_card(card_id)   # Input:
                                        ## card_id (integer, string, required)
                                        # Output:
                                        ## Generic containing card id and `card_deleted => true` attribute

For example:

response = @client.destroy_payment_card card_id
response.card_deleted # => true

Alternatively:

card = @client.payment_card card_id
response = card.destroy