Sha256: 1cb8af1d17942b37d7916efac36471d43bab362fc2ab25f0bf18dbbd5562b577

Contents?: true

Size: 382 Bytes

Versions: 18

Compression:

Stored size: 382 Bytes

Contents

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])
        if page.blank?
          page = create(params)
        end
        page
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
action_kit_rest-0.4.4 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.3 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.2 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.1 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.4.0 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.8 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.7 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.6 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.5 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.4 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.3 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.2 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.1 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.3.0 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.2.2 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.2.1 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.2.0 lib/action_kit_rest/pages/base.rb
action_kit_rest-0.1.1 lib/action_kit_rest/pages/base.rb