Sha256: 8b4f70e92bd0de0ec3aad76fb3bc02ae6398f3c1a55c789cacb8686f56507b12

Contents?: true

Size: 1.12 KB

Versions: 16

Compression:

Stored size: 1.12 KB

Contents

module PortaText
  module Command
    module Api
      # The me/credit_cards/:id endpoint.
      # https://github.com/PortaText/docs/wiki/REST-API#api_credit_cards
      #
      # Author::    Marcelo Gornstein (mailto:marcelog@portatext.com)
      # Copyright:: Copyright (c) 2015 PortaText
      # License::   Apache-2.0
      class CreditCards < Base
        def id(id)
          set :id, id
        end

        def name_on_card(first, last)
          set :first_name, first
          set :last_name, last
        end

        def card_info(number, expiration_date, code)
          set :card_number, number
          set :card_expiration_date, expiration_date
          set :card_code, code
        end

        def address(street_address, city, state, zip, country)
          set :address, street_address
          set :city, city
          set :state, state
          set :zip, zip
          set :country, country
        end

        def endpoint(_method)
          return 'me/credit_cards' if @args[:id].nil?
          id = @args[:id]
          @args.delete :id
          "me/credit_cards/#{id}"
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
portatext-1.2.0 lib/portatext/command/api/credit_cards.rb
portatext-1.1.11 lib/portatext/command/api/credit_cards.rb
portatext-1.1.10 lib/portatext/command/api/credit_cards.rb
portatext-1.1.9 lib/portatext/command/api/credit_cards.rb
portatext-1.1.8 lib/portatext/command/api/credit_cards.rb
portatext-1.1.7 lib/portatext/command/api/credit_cards.rb
portatext-1.1.6 lib/portatext/command/api/credit_cards.rb
portatext-1.1.5 lib/portatext/command/api/credit_cards.rb
portatext-1.1.4 lib/portatext/command/api/credit_cards.rb
portatext-1.1.3 lib/portatext/command/api/credit_cards.rb
portatext-1.1.2 lib/portatext/command/api/credit_cards.rb
portatext-1.1.1 lib/portatext/command/api/credit_cards.rb
portatext-1.1.0 lib/portatext/command/api/credit_cards.rb
portatext-1.0.0 lib/portatext/command/api/credit_cards.rb
portatext-1.0.0.pre lib/portatext/command/api/credit_cards.rb
portatext-0.0.2 lib/portatext/command/api/credit_cards.rb