Class: MistApi::AdminInvite

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/admin_invite.rb

Overview

AdminInvite Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(email = nil, first_name = nil, last_name = nil, org_name = nil, password = nil, recaptcha = nil, account_only = false, allow_mist = false, city = SKIP, country = SKIP, invite_code = SKIP, recaptcha_flavor = RecaptchaFlavorEnum::GOOGLE, referer_invite_token = SKIP, return_to = SKIP, state = SKIP, street_address = SKIP, street_address_2 = SKIP, zipcode = SKIP, additional_properties = nil) ⇒ AdminInvite

Returns a new instance of AdminInvite.



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
# File 'lib/mist_api/models/admin_invite.rb', line 132

def initialize(email = nil, first_name = nil, last_name = nil,
               org_name = nil, password = nil, recaptcha = nil,
                = false, allow_mist = false, city = SKIP,
               country = SKIP, invite_code = SKIP,
               recaptcha_flavor = RecaptchaFlavorEnum::GOOGLE,
               referer_invite_token = SKIP, return_to = SKIP, state = SKIP,
               street_address = SKIP, street_address_2 = SKIP,
               zipcode = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_only =  unless  == SKIP
  @allow_mist = allow_mist unless allow_mist == SKIP
  @city = city unless city == SKIP
  @country = country unless country == SKIP
  @email = email
  @first_name = first_name
  @invite_code = invite_code unless invite_code == SKIP
  @last_name = last_name
  @org_name = org_name
  @password = password
  @recaptcha = recaptcha
  @recaptcha_flavor = recaptcha_flavor unless recaptcha_flavor == SKIP
  @referer_invite_token = referer_invite_token unless referer_invite_token == SKIP
  @return_to = return_to unless return_to == SKIP
  @state = state unless state == SKIP
  @street_address = street_address unless street_address == SKIP
  @street_address_2 = street_address_2 unless street_address_2 == SKIP
  @zipcode = zipcode unless zipcode == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_onlyTrueClass | FalseClass

Skip creating initial setup if true

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/mist_api/models/admin_invite.rb', line 14

def 
  @account_only
end

#allow_mistTrueClass | FalseClass

Whether to allow Mist to look at this org

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/mist_api/models/admin_invite.rb', line 18

def allow_mist
  @allow_mist
end

#cityString

City of registering user

Returns:

  • (String)


22
23
24
# File 'lib/mist_api/models/admin_invite.rb', line 22

def city
  @city
end

#countryString

Country/region name or ISO code of registering user

Returns:

  • (String)


26
27
28
# File 'lib/mist_api/models/admin_invite.rb', line 26

def country
  @country
end

#emailString

Country/region name or ISO code of registering user

Returns:

  • (String)


30
31
32
# File 'lib/mist_api/models/admin_invite.rb', line 30

def email
  @email
end

#first_nameString

Country/region name or ISO code of registering user

Returns:

  • (String)


34
35
36
# File 'lib/mist_api/models/admin_invite.rb', line 34

def first_name
  @first_name
end

#invite_codeString

Required initially

Returns:

  • (String)


38
39
40
# File 'lib/mist_api/models/admin_invite.rb', line 38

def invite_code
  @invite_code
end

#last_nameString

Required initially

Returns:

  • (String)


42
43
44
# File 'lib/mist_api/models/admin_invite.rb', line 42

def last_name
  @last_name
end

#org_nameString

Required initially

Returns:

  • (String)


46
47
48
# File 'lib/mist_api/models/admin_invite.rb', line 46

def org_name
  @org_name
end

#passwordString

Required initially

Returns:

  • (String)


50
51
52
# File 'lib/mist_api/models/admin_invite.rb', line 50

def password
  @password
end

#recaptchaString

reCAPTCHA , see www.google.com/recaptcha/

Returns:

  • (String)


54
55
56
# File 'lib/mist_api/models/admin_invite.rb', line 54

def recaptcha
  @recaptcha
end

#recaptcha_flavorRecaptchaFlavorEnum

flavor of the captcha. enum: ‘google`, `hcaptcha`

Returns:



58
59
60
# File 'lib/mist_api/models/admin_invite.rb', line 58

def recaptcha_flavor
  @recaptcha_flavor
end

#referer_invite_tokenString

Invite token to apply after account creation

Returns:

  • (String)


62
63
64
# File 'lib/mist_api/models/admin_invite.rb', line 62

def referer_invite_token
  @referer_invite_token
end

#return_toString

URL the user should be redirected back to

Returns:

  • (String)


66
67
68
# File 'lib/mist_api/models/admin_invite.rb', line 66

def return_to
  @return_to
end

#stateString

State name or ISO code of registering user, optional (depends on country/region)

Returns:

  • (String)


71
72
73
# File 'lib/mist_api/models/admin_invite.rb', line 71

def state
  @state
end

#street_addressString

Street address of registering user

Returns:

  • (String)


75
76
77
# File 'lib/mist_api/models/admin_invite.rb', line 75

def street_address
  @street_address
end

#street_address_2String

Street address 2 of registering user

Returns:

  • (String)


79
80
81
# File 'lib/mist_api/models/admin_invite.rb', line 79

def street_address_2
  @street_address_2
end

#zipcodeString

zipcode of registering user

Returns:

  • (String)


83
84
85
# File 'lib/mist_api/models/admin_invite.rb', line 83

def zipcode
  @zipcode
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/mist_api/models/admin_invite.rb', line 165

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  email = hash.key?('email') ? hash['email'] : nil
  first_name = hash.key?('first_name') ? hash['first_name'] : nil
  last_name = hash.key?('last_name') ? hash['last_name'] : nil
  org_name = hash.key?('org_name') ? hash['org_name'] : nil
  password = hash.key?('password') ? hash['password'] : nil
  recaptcha = hash.key?('recaptcha') ? hash['recaptcha'] : nil
   = hash['account_only'] ||= false
  allow_mist = hash['allow_mist'] ||= false
  city = hash.key?('city') ? hash['city'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  invite_code = hash.key?('invite_code') ? hash['invite_code'] : SKIP
  recaptcha_flavor =
    hash['recaptcha_flavor'] ||= RecaptchaFlavorEnum::GOOGLE
  referer_invite_token =
    hash.key?('referer_invite_token') ? hash['referer_invite_token'] : SKIP
  return_to = hash.key?('return_to') ? hash['return_to'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  street_address =
    hash.key?('street_address') ? hash['street_address'] : SKIP
  street_address_2 =
    hash.key?('street_address 2') ? hash['street_address 2'] : SKIP
  zipcode = hash.key?('zipcode') ? hash['zipcode'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  AdminInvite.new(email,
                  first_name,
                  last_name,
                  org_name,
                  password,
                  recaptcha,
                  ,
                  allow_mist,
                  city,
                  country,
                  invite_code,
                  recaptcha_flavor,
                  referer_invite_token,
                  return_to,
                  state,
                  street_address,
                  street_address_2,
                  zipcode,
                  additional_properties)
end

.namesObject

A mapping from model property names to API property names.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/mist_api/models/admin_invite.rb', line 86

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_only'] = 'account_only'
  @_hash['allow_mist'] = 'allow_mist'
  @_hash['city'] = 'city'
  @_hash['country'] = 'country'
  @_hash['email'] = 'email'
  @_hash['first_name'] = 'first_name'
  @_hash['invite_code'] = 'invite_code'
  @_hash['last_name'] = 'last_name'
  @_hash['org_name'] = 'org_name'
  @_hash['password'] = 'password'
  @_hash['recaptcha'] = 'recaptcha'
  @_hash['recaptcha_flavor'] = 'recaptcha_flavor'
  @_hash['referer_invite_token'] = 'referer_invite_token'
  @_hash['return_to'] = 'return_to'
  @_hash['state'] = 'state'
  @_hash['street_address'] = 'street_address'
  @_hash['street_address_2'] = 'street_address 2'
  @_hash['zipcode'] = 'zipcode'
  @_hash
end

.nullablesObject

An array for nullable fields



128
129
130
# File 'lib/mist_api/models/admin_invite.rb', line 128

def self.nullables
  []
end

.optionalsObject

An array for optional fields



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/mist_api/models/admin_invite.rb', line 110

def self.optionals
  %w[
    account_only
    allow_mist
    city
    country
    invite_code
    recaptcha_flavor
    referer_invite_token
    return_to
    state
    street_address
    street_address_2
    zipcode
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/mist_api/models/admin_invite.rb', line 234

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_only: #{@account_only.inspect}, allow_mist: #{@allow_mist.inspect},"\
  " city: #{@city.inspect}, country: #{@country.inspect}, email: #{@email.inspect},"\
  " first_name: #{@first_name.inspect}, invite_code: #{@invite_code.inspect}, last_name:"\
  " #{@last_name.inspect}, org_name: #{@org_name.inspect}, password: #{@password.inspect},"\
  " recaptcha: #{@recaptcha.inspect}, recaptcha_flavor: #{@recaptcha_flavor.inspect},"\
  " referer_invite_token: #{@referer_invite_token.inspect}, return_to: #{@return_to.inspect},"\
  " state: #{@state.inspect}, street_address: #{@street_address.inspect}, street_address_2:"\
  " #{@street_address_2.inspect}, zipcode: #{@zipcode.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



222
223
224
225
226
227
228
229
230
231
# File 'lib/mist_api/models/admin_invite.rb', line 222

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_only: #{@account_only}, allow_mist: #{@allow_mist}, city: #{@city},"\
  " country: #{@country}, email: #{@email}, first_name: #{@first_name}, invite_code:"\
  " #{@invite_code}, last_name: #{@last_name}, org_name: #{@org_name}, password: #{@password},"\
  " recaptcha: #{@recaptcha}, recaptcha_flavor: #{@recaptcha_flavor}, referer_invite_token:"\
  " #{@referer_invite_token}, return_to: #{@return_to}, state: #{@state}, street_address:"\
  " #{@street_address}, street_address_2: #{@street_address_2}, zipcode: #{@zipcode},"\
  " additional_properties: #{@additional_properties}>"
end