Class: RedhatAccess::Strata::Client
- Inherits:
-
Object
- Object
- RedhatAccess::Strata::Client
- Defined in:
- lib/redhat_access/strata/client.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
- #get_portal_http_proxy ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(token) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/redhat_access/strata/client.rb', line 6 def initialize(token) username = "" password = "" unless token.nil? token = Base64.decode64(token) username,password = token.split(":") end config = RedHatSupportLib::Network::Config.new config.base_uri = 'https://api.' + REDHAT_ACCESS_CONFIG[:strata_host] config.username= username config.password = password config.proxy = get_portal_http_proxy = {:max_http_size => REDHAT_ACCESS_CONFIG[:attachment_max_http_size], :ftp_host => REDHAT_ACCESS_CONFIG[:attachment_ftp_host], :ftp_remote_dir => REDHAT_ACCESS_CONFIG[:attachment_ftp_dir]} @api = RedHatSupportLib::Api::API.new(config,) end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
5 6 7 |
# File 'lib/redhat_access/strata/client.rb', line 5 def api @api end |
Instance Method Details
#get_portal_http_proxy ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/redhat_access/strata/client.rb', line 24 def get_portal_http_proxy proxy = nil if Katello.config.cdn_proxy && Katello.config.cdn_proxy.host proxy_config = Katello.config.cdn_proxy uri = URI('') uri.scheme = URI.parse(proxy_config.host).scheme uri.host = URI.parse(proxy_config.host).host uri.port = proxy_config.port uri.user = proxy_config.user uri.password = proxy_config.password proxy = uri.to_s end return proxy end |