Sha256: 26430c9f41395302e3d9aeeb7d964ba179dcef5c449f213a245600f4bfaa7fee

Contents?: true

Size: 1.18 KB

Versions: 66

Compression:

Stored size: 1.18 KB

Contents

##
# source_gp_id   string  The source feature id
# new_gp_id  string  New feature id
# name   string  New Feature Plan name
# description  boolean   New Feature Plan description
# 

# Method: featurePlans.clone
module Alula
  class FeaturePlanCloneProc < Alula::RpcResource

    class Response < Alula::RpcResponse
      def initialize(response)
        super(response)
        #
        # This RPC response gives a new FeaturePlan item
        data = response.data['result'][0]
        attributes = {
          id: data['id'],
          gp_id: data['gp_id'],
          name: data['name'],
          description: data['description'],
        }
        @data = Alula::FeaturePlan.new(data['id'], attributes)
      end

      def ok?
        @result.is_a?(Array) || (@result['errors'].nil? && @result['error'].nil?)
      end
    end

    def self.call(source_gp_id:, new_gp_id:, name:, description: "")
      payload = {
        sourceGpId: source_gp_id,
        newGpId: new_gp_id,
        name: name,
        description: description
      }

      request( 
        http_method: :post,
        path: '/rpc/v1/features/clone',
        payload: payload,
        handler: Response
      )
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
alula-ruby-2.1.2 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-2.1.1 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-2.1.0 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-2.0.0 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.10.5 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.10.4 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.10.3 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.10.2 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.10.1 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.10.0 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.17 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.16 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.15 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.14 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.13 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.12 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.11 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.10 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.9 lib/alula/procedures/feature_plan_clone_proc.rb
alula-ruby-1.9.8 lib/alula/procedures/feature_plan_clone_proc.rb