Sha256: f937c70612b729711799e4fd1ee7044cd615aab87ec4012915e9ab6d82597d03

Contents?: true

Size: 891 Bytes

Versions: 15

Compression:

Stored size: 891 Bytes

Contents

module Stripe
  class Source < APIResource
    extend Stripe::APIOperations::Create
    include Stripe::APIOperations::Save

    OBJECT_NAME = 'source'

    def delete(params={}, opts={})
      if respond_to?(:customer) && !customer.nil? && !customer.empty?
        url = "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
        resp, opts = request(:delete, url, params, Util.normalize_opts(opts))
        initialize_from(resp.data, opts)
      else
        raise NotImplementedError.new("Source objects cannot be deleted, they can only be detached from customer objects. This source object does not appear to be currently attached to a customer object.")
      end
    end

    def verify(params={}, opts={})
      resp, opts = request(:post, resource_url + '/verify', params, Util.normalize_opts(opts))
      initialize_from(resp.data, opts)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
stripe-3.3.2 lib/stripe/source.rb
stripe-3.3.1 lib/stripe/source.rb
stripe-3.3.0 lib/stripe/source.rb
stripe-3.2.0 lib/stripe/source.rb
stripe-3.1.0 lib/stripe/source.rb
stripe-3.0.3 lib/stripe/source.rb
stripe-3.0.1 lib/stripe/source.rb
stripe-3.0.0 lib/stripe/source.rb
stripe-2.12.0 lib/stripe/source.rb
stripe-2.11.0 lib/stripe/source.rb
stripe-2.10.0 lib/stripe/source.rb
stripe-2.9.0 lib/stripe/source.rb
stripe-2.8.0 lib/stripe/source.rb
stripe-2.7.0 lib/stripe/source.rb
stripe-2.6.0 lib/stripe/source.rb