class Giftbit
Constants
- VERSION
Public Class Methods
each_auth() { |new auth: name| ... }
click to toggle source
This lets you call the same API requests on every account you have. This is useful e.g. to check the status of every gift in every account.
# File lib/giftbit.rb, line 17 def self.each_auth fail 'no auths set' unless auths auths.each do |name, _| yield new auth: name end end
new(auth:)
click to toggle source
Class-level methods only work if you have a single API account. This lets you instantiate the API for a given account, if you have multiple.
# File lib/giftbit.rb, line 10 def initialize(auth:) fail 'no auths set' unless auths = self.class.auths self.auth = auths.fetch(auth) end
Public Instance Methods
==(other)
click to toggle source
# File lib/giftbit.rb, line 24 def ==(other) other.is_a?(Giftbit) && auth == other.auth end