• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-ruby / #5867

18 Apr 2024 09:24PM UTC coverage: 92.724% (-4.8%) from 97.485%
#5867

push

github

ramya-stripe
Bump version to 11.2.0

10067 of 10857 relevant lines covered (92.72%)

258.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.96
/lib/stripe/singleton_api_resource.rb
1
# frozen_string_literal: true
2

3
module Stripe
1✔
4
  class SingletonAPIResource < APIResource
1✔
5
    def self.resource_url
1✔
6
      if self == SingletonAPIResource
10✔
7
        raise NotImplementedError,
×
8
              "SingletonAPIResource is an abstract class. You should " \
9
              "perform actions on its subclasses (Balance, etc.)"
10
      end
11
      # Namespaces are separated in object names with periods (.) and in URLs
12
      # with forward slashes (/), so replace the former with the latter.
13
      "/v1/#{object_name.downcase.tr('.', '/')}"
10✔
14
    end
15

16
    def resource_url
1✔
17
      self.class.resource_url
8✔
18
    end
19

20
    def self.retrieve(params_or_opts = {}, definitely_opts = nil)
1✔
21
      opts = nil
8✔
22
      params = nil
8✔
23
      if definitely_opts.nil?
8✔
24
        unrecognized_key = params_or_opts.keys.find { |k| !Util::OPTS_USER_SPECIFIED.include?(k) }
7✔
25
        if unrecognized_key
5✔
26
          raise ArgumentError,
1✔
27
                "Unrecognized request option: #{unrecognized_key}. Did you mean to specify this as retrieve params? " \
×
28
                "If so, you must explicitly pass an opts hash as a second argument. " \
29
                "For example: .retrieve({#{unrecognized_key}: 'foo'}, {})"
×
30
        end
31

32
        opts = params_or_opts
4✔
33
      else
34
        opts = definitely_opts
3✔
35
        params = params_or_opts
3✔
36
      end
37

38
      instance = new(params, Util.normalize_opts(opts))
7✔
39
      instance.refresh
7✔
40
      instance
7✔
41
    end
42
  end
43
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc