Sha256: d208cbfefce6e06e41737805686025e76e78453c2adb93c31292c1e71ded8a36

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 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)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cm_quiz-0.0.2 lib/cm_quiz/factory/idea.rb
cm_quiz-0.0.1 lib/cm_quiz/factory/idea.rb