Module: Apps::Align

Defined in:
lib/oct_td_factory/apps/align.rb

Class Method Summary collapse

Instance Method Summary collapse

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 = (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 = .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

.headless_login(creator) ⇒ Object



11
12
13
14
15
16
# File 'lib/oct_td_factory/apps/align.rb', line 11

def self.(creator)
  Services::Login.(creator)
  # get that user's token
  token = Services::Login.get_logged_in_bearer_token
  token
end

Instance Method Details

#loginObject

  • Create Align topic

  • Create Align comment



7
8
9
# File 'lib/oct_td_factory/apps/align.rb', line 7

def 
  @login ||= AlignLogin.new
end