Class: JanioAPI::Base

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/janio_api/resources/base.rb

Direct Known Subclasses

Item, Order

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, persisted = false) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/janio_api/resources/base.rb', line 7

def initialize(attributes = {}, persisted = false)
  # check if config host and api token is set
  unless JanioAPI.config.api_tokens || JanioAPI.config.api_token
    raise ArgumentError, "JanioAPI api_token/api_tokens is missing, please set it in the config."
  end

  unless JanioAPI.config.api_host
    raise ArgumentError, "JanioAPI api_host is missing, please set it in the config."
  end

  super
end