Sha256: f11be94a7ef73fb9fb1035539ea1c0d1b5cc589be2a5e30b541cfc34927907b9

Contents?: true

Size: 384 Bytes

Versions: 6

Compression:

Stored size: 384 Bytes

Contents

# frozen_string_literal: true

module ActionKitRest
  module Pages
    class Base < ActionKitRest::Base
      # allows finding by name
      def find(name)
        response = list(name: name)
        response.obj.first
      end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
action_kit_rest-0.4.10 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.9 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.8 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.7 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.6 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.5 lib/action_kit_rest/pages/base.rb