Class: WhenIWork::Position

Inherits:
Object
  • Object
show all
Includes:
Response
Defined in:
lib/wheniwork-ruby/models/position.rb

Instance Attribute Summary collapse

Attributes included from Response

#raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Response

#_deserialize, #_to_hash, #build_from_hash, #eql?, #to_body, #to_hash, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Position

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/wheniwork-ruby/models/position.rb', line 55

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}

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'color')
    self.color = attributes[:'color']
  end

  if attributes.has_key?(:'sort')
    self.sort = attributes[:'sort']
  end

end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



30
31
32
# File 'lib/wheniwork-ruby/models/position.rb', line 30

def color
  @color
end

#idObject

Returns the value of attribute id.



28
29
30
# File 'lib/wheniwork-ruby/models/position.rb', line 28

def id
  @id
end

#nameObject

Returns the value of attribute name.



29
30
31
# File 'lib/wheniwork-ruby/models/position.rb', line 29

def name
  @name
end

#sortObject

Returns the value of attribute sort.



31
32
33
# File 'lib/wheniwork-ruby/models/position.rb', line 31

def sort
  @sort
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



34
35
36
37
38
39
40
41
# File 'lib/wheniwork-ruby/models/position.rb', line 34

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'color' => :'color',
    :'sort' => :'sort'
  }
end

.swagger_typesObject

Attribute type mapping.



44
45
46
47
48
49
50
51
# File 'lib/wheniwork-ruby/models/position.rb', line 44

def self.swagger_types
  {
    :'id' => :'Integer',
    :'name' => :'String',
    :'color' => :'String',
    :'sort' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



93
94
95
96
97
98
99
100
# File 'lib/wheniwork-ruby/models/position.rb', line 93

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      color == o.color &&
      sort == o.sort
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



104
105
106
# File 'lib/wheniwork-ruby/models/position.rb', line 104

def hash
  [id, name, color, sort].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



81
82
83
84
# File 'lib/wheniwork-ruby/models/position.rb', line 81

def list_invalid_properties
  invalid_properties = Array.new
  return invalid_properties
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



88
89
# File 'lib/wheniwork-ruby/models/position.rb', line 88

def valid?
end