Sha256: 84c5357d38914b42c3bff94895fba024eae23e0f6613e2395be239d024c22b51

Contents?: true

Size: 757 Bytes

Versions: 6

Compression:

Stored size: 757 Bytes

Contents

require 'securerandom'

module CmQuiz
  module Factory
    class Idea
      def initialize(project_api:, jwt:, idea_params: {})
        @project_api = project_api
        @jwt = jwt
        @idea_params = idea_params
      end

      def create
        default_idea_params = {
          content: 'the-content',
          impact: 7,
          ease: 8,
          confidence: 9
        }

        options = {
          headers: {
            'x-access-token' => @jwt
          },
          body: default_idea_params.merge(@idea_params)
        }

        res = @project_api.request(:post, '/ideas', options)
        JSON.parse(res.body)
      rescue => e
        raise StandardError, "Create test idea failed, reason: #{e.message}"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cm_quiz-0.0.8 lib/cm_quiz/factory/idea.rb
cm_quiz-0.0.7 lib/cm_quiz/factory/idea.rb
cm_quiz-0.0.6 lib/cm_quiz/factory/idea.rb
cm_quiz-0.0.5 lib/cm_quiz/factory/idea.rb
cm_quiz-0.0.4 lib/cm_quiz/factory/idea.rb
cm_quiz-0.0.3 lib/cm_quiz/factory/idea.rb