Class: ActionKitRest::Pages::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/action_kit_rest/pages/base.rb

Instance Method Summary collapse

Methods inherited from Base

#create, #get, #list, #normalized_base_path, #update

Instance Method Details

#find(name) ⇒ Object

allows finding by name



5
6
7
8
# File 'lib/action_kit_rest/pages/base.rb', line 5

def find(name)
  response = list(name: name)
  response.obj.first
end

#find_or_create(params) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/action_kit_rest/pages/base.rb', line 10

def find_or_create(params)
  page = find(params[:name])
  if page.blank?
    page = create(params)
  end
  page
end