Class: CoalescingPanda::BearcatUri

Inherits:
Object
  • Object
show all
Defined in:
lib/coalescing_panda/bearcat_uri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ BearcatUri

Returns a new instance of BearcatUri.



4
5
6
7
# File 'lib/coalescing_panda/bearcat_uri.rb', line 4

def initialize(uri)
  Rails.logger.info "Parsing Bearcat URI: #{uri}"
  @uri = URI.parse(uri)
end

Instance Attribute Details

#uriObject

Returns the value of attribute uri.



2
3
4
# File 'lib/coalescing_panda/bearcat_uri.rb', line 2

def uri
  @uri
end

Instance Method Details

#api_domainObject



9
10
11
# File 'lib/coalescing_panda/bearcat_uri.rb', line 9

def api_domain
  uri.port.present? ? "#{uri.host}:#{uri.port.to_s}" : uri.host
end

#prefixObject



17
18
19
# File 'lib/coalescing_panda/bearcat_uri.rb', line 17

def prefix
  [scheme, api_domain].join
end

#schemeObject



13
14
15
# File 'lib/coalescing_panda/bearcat_uri.rb', line 13

def scheme
  [uri.scheme, '://'].join
end