Module: Apps::Align
- Defined in:
- lib/oct_td_factory/apps/align.rb
Class Method Summary collapse
- .create_comment(creator, participant_id) ⇒ Object
-
.create_topic(creator, participant) ⇒ Object
use in before block.
- .headless_login(creator) ⇒ Object
Instance Method Summary collapse
-
#login ⇒ Object
-
Create Align topic - Create Align comment.
-
Class Method Details
.create_comment(creator, participant_id) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/oct_td_factory/apps/align.rb', line 58 def self.create_comment(creator, participant_id) topic_id = create_topic(creator, participant_id)['data']['createAlignTopic']['topic']['id'] token = headless_login(creator) payload = { variables: { input: { text: 'comment created by automation', topicId: topic_id } }, query: 'mutation createAlignTopicComment( $input: CreateAlignTopicCommentMutationInput! ) { createAlignTopicComment(input: $input) { comment { id text createdAt modifiedAt deletedAt owner { id } } } }' } response = JSON.parse(Api::Graphql.post(token, payload).body) Capybara.current_session.cleanup! response end |
.create_topic(creator, participant) ⇒ Object
use in before block
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/oct_td_factory/apps/align.rb', line 18 def self.create_topic(creator, participant) # use in before block participant_id = ENV.fetch("#{participant}_UUID") token = login.user_token(creator) payload = { variables: { input: { title: 'topic created by automation', participantId: participant_id } }, query: 'mutation createAlignTopic($input: CreateAlignTopicMutationInput!) { createAlignTopic(input: $input) { topic { id title resolvedAt resolvedBy { id } createdAt modifiedAt deletedAt owner { id } participants { nodes { identity { id } } } } } }' } response = JSON.parse(Api::Graphql.post(token, payload).body) Capybara.current_session.cleanup! response end |
Instance Method Details
#login ⇒ Object
-
Create Align topic
-
Create Align comment
7 8 9 |
# File 'lib/oct_td_factory/apps/align.rb', line 7 def login @login ||= AlignLogin.new end |