Method: Oceanarium::Region#initialize

Defined in:
lib/oceanarium/resources/region.rb

#initialize(option, api_key, client_id) ⇒ Region

Returns a new instance of Region.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/oceanarium/resources/region.rb', line 5

def initialize(option, api_key, client_id)
  if api_key.nil? || client_id.nil?
    raise 'No API key/client ID!'
  else
    if option.is_a?(Hash)
      @object = option
    end
    if @object.nil?
      self.id = nil
    else
      self.id = @object['id']
      self.name = @object['name']
      self.slug = @object['slug']
    end
  end
end