Sha256: d4ae10d0cc9750a698d8afcd7cf94f956c0d602e0ad819de7d7100f4aef13997

Contents?: true

Size: 1.78 KB

Versions: 8

Compression:

Stored size: 1.78 KB

Contents

# frozen_string_literal: true

module RubyLokaliseApi
  module Rest
    module PaymentCards
      # Returns payment cards
      #
      # @see https://developers.lokalise.com/reference/list-all-cards
      # @return [RubyLokaliseApi::Collections::PaymentCards]
      # @param req_params [Hash]
      def payment_cards(req_params = {})
        name = 'PaymentCards'
        params = { req: req_params }

        data = endpoint(name: name, params: params).do_get

        collection name, data
      end

      # Returns a single payment card
      #
      # @see https://developers.lokalise.com/reference/retrieve-a-card
      # @return [RubyLokaliseApi::Resources::PaymentCard]
      # @param card_id [String, Integer]
      def payment_card(card_id)
        params = { query: card_id }

        data = endpoint(name: 'PaymentCards', params: params).do_get

        resource 'PaymentCard', data
      end

      # Creates a payment card
      #
      # @see https://developers.lokalise.com/reference/create-a-card
      # @return [RubyLokaliseApi::Resources::PaymentCard]
      # @param req_params [Hash]
      def create_payment_card(req_params)
        params = { req: req_params }

        data = endpoint(name: 'PaymentCards', params: params).do_post

        resource 'PaymentCard', data
      end

      # Deletes a payment card
      #
      # @see https://developers.lokalise.com/reference/delete-a-card
      # @return [RubyLokaliseApi::Generics::DeletedResource]
      # @param card_id [String, Integer]
      def destroy_payment_card(card_id)
        params = { query: card_id }

        data = endpoint(name: 'PaymentCards', params: params).do_delete

        RubyLokaliseApi::Generics::DeletedResource.new data.content
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby-lokalise-api-9.3.0 lib/ruby_lokalise_api/rest/payment_cards.rb
ruby-lokalise-api-9.2.1 lib/ruby_lokalise_api/rest/payment_cards.rb
ruby-lokalise-api-9.2.0 lib/ruby_lokalise_api/rest/payment_cards.rb
ruby-lokalise-api-9.0.1 lib/ruby_lokalise_api/rest/payment_cards.rb
ruby-lokalise-api-9.0.0 lib/ruby_lokalise_api/rest/payment_cards.rb
ruby-lokalise-api-8.0.1 lib/ruby_lokalise_api/rest/payment_cards.rb
ruby-lokalise-api-8.0.0 lib/ruby_lokalise_api/rest/payment_cards.rb
ruby-lokalise-api-8.0.0.rc1 lib/ruby_lokalise_api/rest/payment_cards.rb