require 'date' module HelixWebServices # A summary of a stream in the system, as provided by the `p4 streams` command. class StreamsCommand # Specifies the stream's name (permanent identifier) and its path in the stream depot, in the form `//depotname/streamname`. attr_accessor :stream # The date the stream specification was last modified. attr_accessor :update # The date and time that the stream specification was last accessed by any Perforce command. attr_accessor :access # The Perforce user or group who owns the stream.\nThe default is the user who created the stream. attr_accessor :owner # Display name of the stream.\nUnlike the Stream: field, this field can be modified.\nDefaults to the streamname portion of the stream path. attr_accessor :name # The parent of this stream.\nMust be none if the stream's `Type:` is mainline, otherwise must be set to an existing stream identifier of the form `//depotname/streamname`. attr_accessor :parent # The stream’s type determines the expected flow of change.\nValid stream types are `mainline`, `virtual`, `development`, and `release`.\n\n- `mainline`:\nThe mainline stream is the parent of all streams in the stream depot. Every stream depot must have at least one mainline stream.\n\n- `virtual`:\nVirtual streams allow merging and copying between parent and child streams without storing local data.\nData is passed through to the destination (a non-virtual stream) after applying restrictions on the scope of files defined in the virtual stream’s view.\nBecause virtual streams do not have files in their depot namespace, it is impossible to import a virtual stream.\n\n- `release`:\nMore stable than the mainline.\nRelease streams copy from the parent and merge to the parent.\n\n- `development`:\nLess stable than the mainline.\nDevelopment streams expect to merge from parent streams and copy to the parent.\n\n- `task`:\nTask streams are lightweight short-lived branches that are useful for bug fixing or new features that only modify a small subset of the branch data.\nBecause branched (copied) files are tracked in a set of shadow tables which are later removed, repository metadata is kept to a minimum when using this type of stream.\nWorkspaces associated with task streams see all branched data, but only modified and promoted data is visible to users with access to the stream’s namespace.\nThe default is stream type is development. attr_accessor :type # Description of the stream. attr_accessor :description # Settings that configure stream behavior as follows:\n\n- `[un]locked`:\nEnable/disable other users' ability to edit or delete the stream.\nIf locked, the stream specification cannot be deleted, and only its owner can modify it.\nThe default is unlocked.\n\n- `[all|owner]submit`:\nSpecifies whether all users or only the owner of the stream can submit changes to the stream.\nThe default is allsubmit.\nIf the Owner: of a stream marked ownersubmit is a group, all users who are members of that group can submit changes to the stream.\n\n- `[no]toparent`:\nSpecifies whether integrations from the stream to its parent are expected.\nThe default is toparent.\n\n- `[no]fromparent`:\nSpecifies whether integrations to the stream from its parent are expected.\nThe default is fromparent for mainline and development streams, and nofromparent for release streams.\n\n- `mergeany | mergedown`:\nSpecifies whether the merge flow is restricted or whether merge is permitted from any other stream.\nFor example, the mergeany option would allow a merge from a child to a parent with no warnings.\nA virtual stream must have its flow options set to notoparent and nofromparent.\nFlow options are ignored for mainline streams. attr_accessor :options # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'stream' => :'stream', :'update' => :'update', :'access' => :'access', :'owner' => :'owner', :'name' => :'name', :'parent' => :'parent', :'type' => :'type', :'description' => :'description', :'options' => :'options' } end # Attribute type mapping. def self.swagger_types { :'stream' => :'String', :'update' => :'DateTime', :'access' => :'DateTime', :'owner' => :'String', :'name' => :'String', :'parent' => :'String', :'type' => :'String', :'description' => :'String', :'options' => :'String' } end def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} if attributes[:'stream'] self.stream = attributes[:'stream'] end if attributes[:'update'] self.update = attributes[:'update'] end if attributes[:'access'] self.access = attributes[:'access'] end if attributes[:'owner'] self.owner = attributes[:'owner'] end if attributes[:'name'] self.name = attributes[:'name'] end if attributes[:'parent'] self.parent = attributes[:'parent'] end if attributes[:'type'] self.type = attributes[:'type'] end if attributes[:'description'] self.description = attributes[:'description'] end if attributes[:'options'] self.options = attributes[:'options'] end end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && stream == o.stream && update == o.update && access == o.access && owner == o.owner && name == o.name && parent == o.parent && type == o.type && description == o.description && options == o.options end # @see the `==` method def eql?(o) self == o end # Calculate hash code according to all attributes. def hash [stream, update, access, owner, name, parent, type, description, options].hash end # build the object from hash def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) else #TODO show warning in debug mode end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) else # data not found in attributes(hash), not an issue as the data can be optional end end self end def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /^(true|t|yes|y|1)$/i true else false end when /\AArray<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+), (?.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end when :Object value else # model _model = HelixWebServices.const_get(type).new _model.build_from_hash(value) end end def to_s to_hash.to_s end # to_body is an alias to to_body (backward compatibility)) def to_body to_hash end # return the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end # Method to output non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value def _to_hash(value) if value.is_a?(Array) 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