Class: OmniAuth::Strategies::Monday

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/monday.rb

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



16
17
18
19
20
21
22
# File 'lib/omniauth/strategies/monday.rb', line 16

def authorize_params
  super.tap do |params|
    %w[client_options].each do |v|
      params[v.to_sym] = request.params[v] if request.params[v]
    end
  end
end

#callback_urlObject



42
43
44
# File 'lib/omniauth/strategies/monday.rb', line 42

def callback_url
  full_host + script_name + callback_path
end

#meObject



34
35
36
37
38
39
40
# File 'lib/omniauth/strategies/monday.rb', line 34

def me
  @me ||= begin
    access_token.options[:mode] = :header
    response = access_token.post("", body: { query: query }).parsed
    response["data"]["me"].merge("account_id": response["account_id"])
  end
end

#queryObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/omniauth/strategies/monday.rb', line 46

def query
  <<~GRAPHQL
    query {
      me {
      email
      name
      id
    }
    }
  GRAPHQL
end

#raw_infoObject



30
31
32
# File 'lib/omniauth/strategies/monday.rb', line 30

def raw_info
  @raw_info ||= {}
end

#request_phaseObject



12
13
14
# File 'lib/omniauth/strategies/monday.rb', line 12

def request_phase
  super
end