lib/dkron-rb/models/status.rb in dkron-rb-0.11.2 vs lib/dkron-rb/models/status.rb in dkron-rb-1.0.0

- old
+ new

@@ -1,63 +1,91 @@ =begin #Dkron REST API #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response. -OpenAPI spec version: 0.11.2 +OpenAPI spec version: 1 Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.1 +Swagger Codegen version: 2.4.2 =end require 'date' module Dkron # Status represents details about the node. class Status + # Node basic details + attr_accessor :agent + # Serf status + attr_accessor :serf + + # Tags asociated with this node + attr_accessor :tags + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'agent' => :'agent', + :'serf' => :'serf', + :'tags' => :'tags' } end # Attribute type mapping. def self.swagger_types { + :'agent' => :'', + :'serf' => :'', + :'tags' => :'' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key - attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + if attributes.has_key?(:'agent') + self.agent = attributes[:'agent'] + end + + if attributes.has_key?(:'serf') + self.serf = attributes[:'serf'] + end + + if attributes.has_key?(:'tags') + self.tags = attributes[:'tags'] + end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - return invalid_properties + invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return true + true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) - self.class == o.class + self.class == o.class && + agent == o.agent && + serf == o.serf && + tags == o.tags end # @see the `==` method # @param [Object] Object to be compared def eql?(o) @@ -65,11 +93,11 @@ end # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [].hash + [agent, serf, tags].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -78,11 +106,11 @@ self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end @@ -160,20 +188,18 @@ # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) - value.compact.map{ |v| _to_hash(v) } + value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end - end - end