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.18.0 lib/stripe/singleton_api_resource.rb
stripe-4.17.0 lib/stripe/singleton_api_resource.rb
stripe-4.16.0 lib/stripe/singleton_api_resource.rb
stripe-4.15.0 lib/stripe/singleton_api_resource.rb
stripe-4.14.0 lib/stripe/singleton_api_resource.rb
stripe-4.13.0 lib/stripe/singleton_api_resource.rb
stripe-4.12.0 lib/stripe/singleton_api_resource.rb
stripe-4.11.0 lib/stripe/singleton_api_resource.rb
stripe-4.10.0 lib/stripe/singleton_api_resource.rb
stripe-4.9.1 lib/stripe/singleton_api_resource.rb
stripe-4.9.0 lib/stripe/singleton_api_resource.rb
stripe-4.8.1 lib/stripe/singleton_api_resource.rb
stripe-4.8.0 lib/stripe/singleton_api_resource.rb
stripe-4.7.1 lib/stripe/singleton_api_resource.rb
stripe-4.7.0 lib/stripe/singleton_api_resource.rb
stripe-4.6.0 lib/stripe/singleton_api_resource.rb
stripe-4.5.0 lib/stripe/singleton_api_resource.rb
stripe-4.4.1 lib/stripe/singleton_api_resource.rb
stripe-4.4.0 lib/stripe/singleton_api_resource.rb
stripe-4.3.0 lib/stripe/singleton_api_resource.rb