Class: Increase::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/increase/resource.rb

Constant Summary collapse

PAGINATION_MAX_LIMIT =
100

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: nil) ⇒ Resource

Returns a new instance of Resource.



8
9
10
11
12
13
# File 'lib/increase/resource.rb', line 8

def initialize(client: nil)
  if instance_of?(Resource)
    raise NotImplementedError, "Resource is an abstract class. You should perform actions on its subclasses (Accounts, Transactions, Card, etc.)"
  end
  @client = client || Increase.default_client
end

Class Method Details

.resource_urlObject



23
24
25
# File 'lib/increase/resource.rb', line 23

def self.resource_url
  "/#{self::API_NAME}"
end

.with_config(config) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/increase/resource.rb', line 15

def self.with_config(config)
  if config.is_a?(Client)
    new(client: config)
  else
    new(client: Client.new(config))
  end
end