Class: GrowsurfRuby::Models::AffiliateApplication::Answer

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/growsurf_ruby/models/affiliate_application.rb,
sig/growsurf_ruby/models/affiliate_application.rbs

Defined Under Namespace

Modules: Type Classes: Value

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(answers: nil, created_at: nil, decided_at: nil, email: nil, first_name: nil, id: nil, last_name: nil, participant_id: nil, reapply_allowed_at: nil, rejection_reason: nil, reviewed_at: nil, risk_level: nil, status: nil, terms_accepted_at: nil) ⇒ Object

Some parameter documentations has been truncated, see GrowsurfRuby::Models::AffiliateApplication for more details.

Parameters:

  • answers (Array<GrowsurfRuby::Models::AffiliateApplication::Answer>) (defaults to: nil)

    The applicant's answers to the saved application form.

  • created_at (Integer) (defaults to: nil)

    When the application was submitted, in Unix milliseconds.

  • decided_at (Integer, nil) (defaults to: nil)

    When the decision was made, in Unix milliseconds. null while pending.

  • email (String, nil) (defaults to: nil)

    Required applicant email address, or null after applicant data is removed

  • first_name (String, nil) (defaults to: nil)

    Required applicant first name, or null after applicant data is removed under

  • id (String) (defaults to: nil)

    Application ID.

  • last_name (String, nil) (defaults to: nil)

    Required applicant last name, or null after applicant data is removed under

  • participant_id (String, nil) (defaults to: nil)

    ID of the participant created or upgraded by approval. null until the

  • reapply_allowed_at (Integer, nil) (defaults to: nil)

    When a denied applicant may apply again, in Unix milliseconds. null when not

  • rejection_reason (String, nil) (defaults to: nil)

    The structured reason recorded when the application was denied. null until

  • reviewed_at (Integer, nil) (defaults to: nil)

    When the application was reviewed, in Unix milliseconds. null while pending.

  • risk_level (Symbol, GrowsurfRuby::Models::AffiliateApplication::RiskLevel, nil) (defaults to: nil)

    GrowSurf risk assessment. Applications that are not LOW risk are held for

  • status (Symbol, GrowsurfRuby::Models::AffiliateApplication::Status) (defaults to: nil)

    Where the application is in review. Only PENDING applications can be decided.

  • terms_accepted_at (Integer, nil) (defaults to: nil)

    When the applicant accepted the Program Terms, in Unix milliseconds, or null



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
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
# File 'lib/growsurf_ruby/models/affiliate_application.rb', line 134

class Answer < GrowsurfRuby::Internal::Type::BaseModel
  # @!attribute field_id
  #   Stable key of the saved application-form field this answer belongs to.
  #
  #   @return [String]
  required :field_id, String, api_name: :fieldId

  # @!attribute label
  #   Customer-configured field label captured when the applicant submitted.
  #
  #   @return [String]
  required :label, String

  # @!attribute type
  #   Saved field type that determined how the scalar answer was validated.
  #
  #   @return [Symbol, GrowsurfRuby::Models::AffiliateApplication::Answer::Type]
  required :type, enum: -> { GrowsurfRuby::AffiliateApplication::Answer::Type }

  # @!attribute value
  #   Applicant answer represented as one validated string, number, or boolean.
  #
  #   @return [String, Integer, Float, Boolean]
  required :value, -> { GrowsurfRuby::AffiliateApplication::Answer::Value }

  # @!method initialize(field_id: nil, label: nil, type: nil, value: nil)
  #   Some parameter documentations has been truncated, see
  #   {GrowsurfRuby::Models::AffiliateApplication::Answer} for more details.
  #
  #   @param field_id [String] Stable key of the saved application-form field this answer belongs to.
  #
  #   @param label [String] Customer-configured field label captured when the applicant submitted.
  #
  #   @param type [Symbol, GrowsurfRuby::Models::AffiliateApplication::Answer::Type] Saved field type that determined how the scalar answer was validated.
  #
  #   @param value [String, Integer, Float, Boolean] Applicant answer represented as one validated scalar.

  class Value
    extend GrowsurfRuby::Internal::Type::Converter
    extend GrowsurfRuby::Internal::Util::SorbetRuntimeSupport

    private_class_method :new

    def self.===(other)
      scalar?(other)
    end

    def self.coerce(value, state:)
      matches = scalar?(value)
      state.fetch(:exactness)[matches ? :yes : :no] += 1
      state[:error] = ArgumentError.new("expected a string, number, or boolean") unless matches
      value
    end

    def self.to_sorbet_type
      T.any(String, Integer, Float, T::Boolean)
    end

    def self.scalar?(value)
      value.is_a?(String) ||
        value.is_a?(Integer) ||
        value.is_a?(Float) ||
        value == true ||
        value == false
    end
    private_class_method :scalar?
  end

  module Type
    extend GrowsurfRuby::Internal::Type::Enum

    TEXT = :text
    TEXTAREA = :textarea
    URL = :url
    COUNTRY = :country
    NUMBER = :number
    DROPDOWN = :dropdown
    RADIO = :radio
    CHECKBOX = :checkbox

    # @!method self.values
    #   @return [Array<Symbol>]
  end
end

Instance Attribute Details

#field_idString

Stable key of the saved application-form field this answer belongs to.

Parameters:

  • (String)

Returns:

  • (String)


139
# File 'lib/growsurf_ruby/models/affiliate_application.rb', line 139

required :field_id, String, api_name: :fieldId

#labelString

Customer-configured field label captured when the applicant submitted.

Parameters:

  • (String)

Returns:

  • (String)


145
# File 'lib/growsurf_ruby/models/affiliate_application.rb', line 145

required :label, String

#typeSymbol, GrowsurfRuby::Models::AffiliateApplication::Answer::Type

Saved field type that determined how the scalar answer was validated.



151
# File 'lib/growsurf_ruby/models/affiliate_application.rb', line 151

required :type, enum: -> { GrowsurfRuby::AffiliateApplication::Answer::Type }

#valueString, ...

Applicant answer represented as one validated string, number, or boolean.

Returns:

  • (String, Integer, Float, Boolean)


157
# File 'lib/growsurf_ruby/models/affiliate_application.rb', line 157

required :value, -> { GrowsurfRuby::AffiliateApplication::Answer::Value }

Instance Method Details

#to_hash{

Returns:

  • ({)


134
# File 'sig/growsurf_ruby/models/affiliate_application.rbs', line 134

def to_hash: -> {