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
12
13
14
15
# File 'lib/coalescing_panda/bearcat_uri.rb', line 9

def api_domain
  if Rails.env.test? or Rails.env.development?
    uri.port.present? ? URI.encode("#{uri.host}:#{uri.port.to_s}") : uri.host
  else
    uri.host
  end
end

#prefixObject



21
22
23
# File 'lib/coalescing_panda/bearcat_uri.rb', line 21

def prefix
  [scheme, api_domain].join
end

#schemeObject



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

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