Class: FlatApi::OrganizationInvitation

Inherits:
ApiModelBase show all
Defined in:
lib/flat_api/models/organization_invitation.rb

Overview

Details of an invitation to join an organization

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ OrganizationInvitation

Initializes the object

Parameters:

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

    Model attributes in the form of hash



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/flat_api/models/organization_invitation.rb', line 121

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FlatApi::OrganizationInvitation` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `FlatApi::OrganizationInvitation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

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

  if attributes.key?(:'creation_date')
    self.creation_date = attributes[:'creation_date']
  end

  if attributes.key?(:'organization')
    self.organization = attributes[:'organization']
  else
    self.organization = nil
  end

  if attributes.key?(:'organization_role')
    self.organization_role = attributes[:'organization_role']
  else
    self.organization_role = nil
  end

  if attributes.key?(:'custom_code')
    self.custom_code = attributes[:'custom_code']
  else
    self.custom_code = nil
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'invited_by')
    self.invited_by = attributes[:'invited_by']
  end

  if attributes.key?(:'html_url')
    self.html_url = attributes[:'html_url']
  end

  if attributes.key?(:'allow_multiple_use')
    self.allow_multiple_use = attributes[:'allow_multiple_use']
  else
    self.allow_multiple_use = nil
  end

  if attributes.key?(:'used_by')
    if (value = attributes[:'used_by']).is_a?(Array)
      self.used_by = value
    end
  end
end

Instance Attribute Details

#allow_multiple_useObject

If true, the invitation can be used multiple times. If false, the invitation can only be used once.



43
44
45
# File 'lib/flat_api/models/organization_invitation.rb', line 43

def allow_multiple_use
  @allow_multiple_use
end

#creation_dateObject

The creation date of the invitation



23
24
25
# File 'lib/flat_api/models/organization_invitation.rb', line 23

def creation_date
  @creation_date
end

#custom_codeObject

Enrollment code to use when joining this organization



31
32
33
# File 'lib/flat_api/models/organization_invitation.rb', line 31

def custom_code
  @custom_code
end

#emailObject

The email address this invitation was sent to



34
35
36
# File 'lib/flat_api/models/organization_invitation.rb', line 34

def email
  @email
end

#html_urlObject

URL to join the organization using this invitation



40
41
42
# File 'lib/flat_api/models/organization_invitation.rb', line 40

def html_url
  @html_url
end

#idObject

The invitation unique identifier



20
21
22
# File 'lib/flat_api/models/organization_invitation.rb', line 20

def id
  @id
end

#invited_byObject

The unique identifier of the User who created this invitation



37
38
39
# File 'lib/flat_api/models/organization_invitation.rb', line 37

def invited_by
  @invited_by
end

#organizationObject

The unique identifier of the Organization owning this class



26
27
28
# File 'lib/flat_api/models/organization_invitation.rb', line 26

def organization
  @organization
end

#organization_roleObject

Returns the value of attribute organization_role.



28
29
30
# File 'lib/flat_api/models/organization_invitation.rb', line 28

def organization_role
  @organization_role
end

#used_byObject

List of users who used this invitation



46
47
48
# File 'lib/flat_api/models/organization_invitation.rb', line 46

def used_by
  @used_by
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



87
88
89
# File 'lib/flat_api/models/organization_invitation.rb', line 87

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



92
93
94
# File 'lib/flat_api/models/organization_invitation.rb', line 92

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/flat_api/models/organization_invitation.rb', line 71

def self.attribute_map
  {
    :'id' => :'id',
    :'creation_date' => :'creationDate',
    :'organization' => :'organization',
    :'organization_role' => :'organizationRole',
    :'custom_code' => :'customCode',
    :'email' => :'email',
    :'invited_by' => :'invitedBy',
    :'html_url' => :'htmlUrl',
    :'allow_multiple_use' => :'allowMultipleUse',
    :'used_by' => :'usedBy'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/flat_api/models/organization_invitation.rb', line 278

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



113
114
115
116
117
# File 'lib/flat_api/models/organization_invitation.rb', line 113

def self.openapi_nullable
  Set.new([
    :'custom_code',
  ])
end

.openapi_typesObject

Attribute type mapping.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/flat_api/models/organization_invitation.rb', line 97

def self.openapi_types
  {
    :'id' => :'String',
    :'creation_date' => :'Time',
    :'organization' => :'String',
    :'organization_role' => :'OrganizationRoles',
    :'custom_code' => :'String',
    :'email' => :'String',
    :'invited_by' => :'String',
    :'html_url' => :'String',
    :'allow_multiple_use' => :'Boolean',
    :'used_by' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/flat_api/models/organization_invitation.rb', line 248

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      creation_date == o.creation_date &&
      organization == o.organization &&
      organization_role == o.organization_role &&
      custom_code == o.custom_code &&
      email == o.email &&
      invited_by == o.invited_by &&
      html_url == o.html_url &&
      allow_multiple_use == o.allow_multiple_use &&
      used_by == o.used_by
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


265
266
267
# File 'lib/flat_api/models/organization_invitation.rb', line 265

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



271
272
273
# File 'lib/flat_api/models/organization_invitation.rb', line 271

def hash
  [id, creation_date, organization, organization_role, custom_code, email, invited_by, html_url, allow_multiple_use, used_by].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/flat_api/models/organization_invitation.rb', line 188

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @organization.nil?
    invalid_properties.push('invalid value for "organization", organization cannot be nil.')
  end

  if @organization_role.nil?
    invalid_properties.push('invalid value for "organization_role", organization_role cannot be nil.')
  end

  if @allow_multiple_use.nil?
    invalid_properties.push('invalid value for "allow_multiple_use", allow_multiple_use cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/flat_api/models/organization_invitation.rb', line 300

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



208
209
210
211
212
213
214
# File 'lib/flat_api/models/organization_invitation.rb', line 208

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @organization.nil?
  return false if @organization_role.nil?
  return false if @allow_multiple_use.nil?
  true
end