Class: CoalescingPanda::BearcatUri
- Inherits:
-
Object
- Object
- CoalescingPanda::BearcatUri
- Defined in:
- lib/coalescing_panda/bearcat_uri.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #api_domain ⇒ Object
-
#initialize(uri) ⇒ BearcatUri
constructor
A new instance of BearcatUri.
- #prefix ⇒ Object
- #scheme ⇒ Object
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
#uri ⇒ Object
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_domain ⇒ Object
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 |
#prefix ⇒ Object
21 22 23 |
# File 'lib/coalescing_panda/bearcat_uri.rb', line 21 def prefix [scheme, api_domain].join end |
#scheme ⇒ Object
17 18 19 |
# File 'lib/coalescing_panda/bearcat_uri.rb', line 17 def scheme [uri.scheme, '://'].join end |