Class: Misty::Service
- Inherits:
-
Object
- Object
- Misty::Service
- Defined in:
- lib/misty/service.rb
Instance Attribute Summary collapse
-
#microversion ⇒ Object
readonly
Returns the value of attribute microversion.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#versions ⇒ Object
readonly
Returns the value of attribute versions.
Instance Method Summary collapse
- #default_version(api_version = nil) ⇒ Object
-
#initialize(params) ⇒ Service
constructor
A new instance of Service.
- #to_s ⇒ Object
Constructor Details
#initialize(params) ⇒ Service
Returns a new instance of Service.
5 6 7 8 9 10 |
# File 'lib/misty/service.rb', line 5 def initialize(params) @type = params[:type] @project = params[:project] @versions = params[:versions] @microversion = params[:microversion] end |
Instance Attribute Details
#microversion ⇒ Object (readonly)
Returns the value of attribute microversion.
3 4 5 |
# File 'lib/misty/service.rb', line 3 def microversion @microversion end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
3 4 5 |
# File 'lib/misty/service.rb', line 3 def project @project end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/misty/service.rb', line 3 def type @type end |
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
3 4 5 |
# File 'lib/misty/service.rb', line 3 def versions @versions end |
Instance Method Details
#default_version(api_version = nil) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/misty/service.rb', line 19 def default_version(api_version = nil) res = if api_version && (@versions&.include?(api_version)) api_version else self.versions.sort[-1] end res end |
#to_s ⇒ Object
12 13 14 15 16 17 |
# File 'lib/misty/service.rb', line 12 def to_s str = "#{type}: #{project}" str << ", versions: #{@versions}" if @versions str << ", microversion: #{@microversion}" if @microversion str end |