Class: ActionKitRest::Pages::Base
- Defined in:
- lib/action_kit_rest/pages/base.rb
Direct Known Subclasses
DonationPage, EventCampaignPage, ImportPage, SignupPage, UnsubscribePage
Instance Method Summary collapse
-
#find(name) ⇒ Object
allows finding by name.
- #find_or_create(params) ⇒ Object
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 |