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

pulibrary / tigerdata-app / 3d88d2e1-809d-4b21-a053-6167ddb1e670

06 Nov 2025 03:55PM UTC coverage: 91.201% (+10.5%) from 80.673%
3d88d2e1-809d-4b21-a053-6167ddb1e670

push

circleci

web-flow
Fixed link, replaced image, added a test (#2158)

Closes #2156 and #2141

2840 of 3114 relevant lines covered (91.2%)

1092.36 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
6✔
3
  class LogonRequest < Request
6✔
4
    # Specifies the logon service within the Mediaflux API
5
    # @return [String]
6
    def self.service
6✔
7
      "system.logon"
8,860✔
8
    end
9

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

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

22
    # Specifies the password for the Mediaflux API authentication
23
    # @return [String]
24
    def self.mediaflux_password
6✔
25
      mediaflux["api_password"]
4,428✔
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)
6✔
29
      @domain = domain
4,430✔
30
      @user = user
4,430✔
31
      @password = password
4,430✔
32
      @identity_token = identity_token
4,430✔
33
      @token_type = token_type
4,430✔
34
      super()
4,430✔
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
6✔
41
      @session_token ||= response_session_token
4,424✔
42
    end
43

44
    private
6✔
45

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

54
      def response_session_element
6✔
55
        response_xml.xpath("response/reply/result/session")
4,424✔
56
      end
57

58
      def response_session_token
6✔
59
        value = response_session_element.text
4,424✔
60
        value.strip
4,424✔
61
      end
62

63
      def build_http_request_body(name:)
6✔
64
        super do |xml|
8,860✔
65
          xml.args do
8,860✔
66
            if @identity_token.nil?
8,860✔
67
              xml.domain @domain
8,856✔
68
              xml.user @user
8,856✔
69
              xml.password @password
8,856✔
70
            else
71
              xml.token do
4✔
72
                xml.parent.set_attribute("type", @token_type) if @token_type
4✔
73
                xml.text(@identity_token)
4✔
74
              end
75
            end
76
          end
77
        end
78
      end
79
  end
80
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