Sha256: 5319a8f879a8f07f47a3c8abedceb52a906768b94248055f76c1bedc9da02344

Contents?: true

Size: 483 Bytes

Versions: 2

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

# PaymentMethod objects represent a payment method of a user.
class EasyPost::PaymentMethod < EasyPost::Resource
  # Retrieve all payment methods.
  def self.all(api_key = nil)
    response = EasyPost.make_request(:get, url, api_key)

    if response['id'].nil?
      raise EasyPost::Error.new('Billing has not been setup for this user. Please add a payment method.')
    end

    EasyPost::Util.convert_to_easypost_object(response, api_key)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easypost-4.5.0 lib/easypost/payment_method.rb
easypost-4.4.0 lib/easypost/payment_method.rb