Sha256: c50c0396cb97d305013bdbccc20e370b410da1cd96242e5f430903c550f156f8

Contents?: true

Size: 721 Bytes

Versions: 44

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module Stripe
  class SingletonAPIResource < APIResource
    def self.resource_url
      if self == SingletonAPIResource
        raise NotImplementedError, "SingletonAPIResource is an abstract class.  You should perform actions on its subclasses (Account, etc.)"
      end
      # Namespaces are separated in object names with periods (.) and in URLs
      # with forward slashes (/), so replace the former with the latter.
      "/v1/#{self::OBJECT_NAME.downcase.tr('.', '/')}"
    end

    def resource_url
      self.class.resource_url
    end

    def self.retrieve(opts = {})
      instance = new(nil, Util.normalize_opts(opts))
      instance.refresh
      instance
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
stripe-4.2.0 lib/stripe/singleton_api_resource.rb
stripe-4.1.0 lib/stripe/singleton_api_resource.rb
stripe-4.0.3 lib/stripe/singleton_api_resource.rb
stripe-4.0.2 lib/stripe/singleton_api_resource.rb
stripe-4.0.1 lib/stripe/singleton_api_resource.rb
stripe-4.0.0 lib/stripe/singleton_api_resource.rb
stripe-3.31.1 lib/stripe/singleton_api_resource.rb
stripe-3.31.0 lib/stripe/singleton_api_resource.rb
stripe-3.30.0 lib/stripe/singleton_api_resource.rb
stripe-3.29.0 lib/stripe/singleton_api_resource.rb
stripe-3.28.0 lib/stripe/singleton_api_resource.rb
stripe-3.27.0 lib/stripe/singleton_api_resource.rb
stripe-3.26.1 lib/stripe/singleton_api_resource.rb
stripe-3.26.0 lib/stripe/singleton_api_resource.rb
stripe-3.25.0 lib/stripe/singleton_api_resource.rb
stripe-3.24.0 lib/stripe/singleton_api_resource.rb
stripe-3.23.0 lib/stripe/singleton_api_resource.rb
stripe-3.22.0 lib/stripe/singleton_api_resource.rb
stripe-3.21.0 lib/stripe/singleton_api_resource.rb
stripe-3.20.0 lib/stripe/singleton_api_resource.rb