Class: Veye::API::BaseResource
- Inherits:
-
Object
- Object
- Veye::API::BaseResource
- Defined in:
- lib/veye/api/base_resource.rb
Overview
extends child classes with URL and API helpers
Direct Known Subclasses
Instance Attribute Summary collapse
-
#full_path ⇒ Object
readonly
Returns the value of attribute full_path.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ BaseResource
constructor
A new instance of BaseResource.
Constructor Details
#initialize(path = nil) ⇒ BaseResource
Returns a new instance of BaseResource.
7 8 9 |
# File 'lib/veye/api/base_resource.rb', line 7 def initialize(path = nil) @full_path = "#{$global_options[:url]}#{path}" end |
Instance Attribute Details
#full_path ⇒ Object (readonly)
Returns the value of attribute full_path.
5 6 7 |
# File 'lib/veye/api/base_resource.rb', line 5 def full_path @full_path end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
5 6 7 |
# File 'lib/veye/api/base_resource.rb', line 5 def resource @resource end |
Class Method Details
.build_url(global_options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/veye/api/base_resource.rb', line 11 def self.build_url() resource_url = nil protocol = [:protocol] server = [:server] port = .fetch(:port, '') path = [:path] if port.to_s.empty? resource_url = "#{protocol}://#{server}/#{path}" else resource_url = "#{protocol}://#{server}:#{port}/#{path}" end resource_url end |