• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / tigerdata-app / 9b66f5f2-6c7f-431d-bff9-8658c30a14c6

26 Nov 2025 12:16PM UTC coverage: 79.975% (+8.4%) from 71.597%
9b66f5f2-6c7f-431d-bff9-8658c30a14c6

Pull #2248

circleci

carolyncole
Updated rake task description
Pull Request #2248: Fixed rake task description

2592 of 3241 relevant lines covered (79.98%)

240.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/app/models/mediaflux/logon_request.rb
1
# frozen_string_literal: true
2
module Mediaflux
3✔
3
  class LogonRequest < Request
3✔
4
    # Specifies the logon service within the Mediaflux API
5
    # @return [String]
6
    def self.service
3✔
7
      "system.logon"
2,216✔
8
    end
9

10
    # Specifies the user domain for the Mediaflux API authentication
11
    # @return [String]
12
    def self.mediaflux_domain
3✔
13
      mediaflux["api_domain"]
1,107✔
14
    end
15

16
    # Specifies the user for the Mediaflux API authentication
17
    # @return [String]
18
    def self.mediaflux_user
3✔
19
      mediaflux["api_user"]
1,107✔
20
    end
21

22
    # Specifies the password for the Mediaflux API authentication
23
    # @return [String]
24
    def self.mediaflux_password
3✔
25
      mediaflux["api_password"]
1,107✔
26
    end
27

28
    def initialize(domain: self.class.mediaflux_domain, user: self.class.mediaflux_user, password: self.class.mediaflux_password, identity_token: nil, token_type: nil)
3✔
29
      @domain = domain
1,108✔
30
      @user = user
1,108✔
31
      @password = password
1,108✔
32
      @identity_token = identity_token
1,108✔
33
      @token_type = token_type
1,108✔
34
      super()
1,108✔
35
    end
36

37
    # Authenticates the Mediaflux API using the credentials set within the Rails configuration,
38
    # and set the token for the API session if the request has not already been resolved
39
    # @return [String] the session token generated by the Mediaflux API
40
    def session_token
3✔
41
      @session_token ||= response_session_token
1,105✔
42
    end
43

44
    private
3✔
45

46
      class << self
3✔
47
        # The Rails configuration options specifying the Mediaflux server
48
        # @return [Hash]
49
        def mediaflux
3✔
50
          Rails.configuration.mediaflux
3,321✔
51
        end
52
      end
53

54
      def response_session_element
3✔
55
        response_xml.xpath("response/reply/result/session")
1,105✔
56
      end
57

58
      def response_session_token
3✔
59
        value = response_session_element.text
1,105✔
60
        value.strip
1,105✔
61
      end
62

63
      def build_http_request_body(name:)
3✔
64
        super do |xml|
2,216✔
65
          xml.args do
2,216✔
66
            if @identity_token.nil?
2,216✔
67
              xml.domain @domain
2,214✔
68
              xml.user @user
2,214✔
69
              xml.password @password
2,214✔
70
            else
71
              xml.token do
2✔
72
                xml.parent.set_attribute("type", @token_type) if @token_type
2✔
73
                xml.text(@identity_token)
2✔
74
              end
75
            end
76
            # Include the "app" parameter in the login information.
77
            # This information shows when analyzing sessions via `system.session.all.describe`
78
            # but sadly it does NOT show when running `licence.holder.list`
79
            xml.app "TDWEB"
2,216✔
80
          end
81
        end
82
      end
83
  end
84
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc