Class: QwilAPI::ContractorSerializer
- Inherits:
-
Object
- Object
- QwilAPI::ContractorSerializer
- Defined in:
- lib/qwil_api/models/contractor_serializer.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#accounts ⇒ Object
URL of the endpoint describing the User’s Accounts.
-
#business_name ⇒ Object
Business name.
-
#calculate_cashout_available ⇒ Object
Calculate what fees would be charged for a specific Cashout amount.
-
#cashouts ⇒ Object
URL of the endpoint describing the User’s Cashouts.
-
#contractor_type ⇒ Object
Returns the value of attribute contractor_type.
-
#default_account ⇒ Object
Default account to use for payment of unpaid income.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
First name, if the user is an individual.
-
#has_password ⇒ Object
Flag specifying if the User has set their password.
-
#income ⇒ Object
URL of the endpoint describing the User’s Income.
-
#last_name ⇒ Object
Last name, if the user is an individual.
-
#name ⇒ Object
DEPRECATED: The full name of the contractor.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ContractorSerializer
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ContractorSerializer
Initializes the object
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 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 125 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?(:'url') self.url = attributes[:'url'] end if attributes.has_key?(:'email') self.email = attributes[:'email'] end if attributes.has_key?(:'income') self.income = attributes[:'income'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.has_key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.has_key?(:'business_name') self.business_name = attributes[:'business_name'] end if attributes.has_key?(:'contractor_type') self.contractor_type = attributes[:'contractor_type'] end if attributes.has_key?(:'accounts') self.accounts = attributes[:'accounts'] end if attributes.has_key?(:'default_account') self.default_account = attributes[:'default_account'] end if attributes.has_key?(:'cashouts') self.cashouts = attributes[:'cashouts'] end if attributes.has_key?(:'calculate_cashout_available') self.calculate_cashout_available = attributes[:'calculate_cashout_available'] end if attributes.has_key?(:'has_password') self.has_password = attributes[:'has_password'] end end |
Instance Attribute Details
#accounts ⇒ Object
URL of the endpoint describing the User’s Accounts.
49 50 51 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 49 def accounts @accounts end |
#business_name ⇒ Object
Business name. Only use this field if this user is a business entity.
44 45 46 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 44 def business_name @business_name end |
#calculate_cashout_available ⇒ Object
Calculate what fees would be charged for a specific Cashout amount.
58 59 60 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 58 def calculate_cashout_available @calculate_cashout_available end |
#cashouts ⇒ Object
URL of the endpoint describing the User’s Cashouts.
55 56 57 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 55 def cashouts @cashouts end |
#contractor_type ⇒ Object
Returns the value of attribute contractor_type.
46 47 48 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 46 def contractor_type @contractor_type end |
#default_account ⇒ Object
Default account to use for payment of unpaid income.
52 53 54 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 52 def default_account @default_account end |
#email ⇒ Object
Returns the value of attribute email.
29 30 31 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 29 def email @email end |
#first_name ⇒ Object
First name, if the user is an individual. Leave blank if this user is a company.
38 39 40 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 38 def first_name @first_name end |
#has_password ⇒ Object
Flag specifying if the User has set their password.
61 62 63 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 61 def has_password @has_password end |
#income ⇒ Object
URL of the endpoint describing the User’s Income.
32 33 34 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 32 def income @income end |
#last_name ⇒ Object
Last name, if the user is an individual. Leave blank if this user is a company.
41 42 43 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 41 def last_name @last_name end |
#name ⇒ Object
DEPRECATED: The full name of the contractor. Use first_name/last_name instead.
35 36 37 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 35 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
27 28 29 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 27 def url @url end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 86 def self.attribute_map { :'url' => :'url', :'email' => :'email', :'income' => :'income', :'name' => :'name', :'first_name' => :'first_name', :'last_name' => :'last_name', :'business_name' => :'business_name', :'contractor_type' => :'contractor_type', :'accounts' => :'accounts', :'default_account' => :'default_account', :'cashouts' => :'cashouts', :'calculate_cashout_available' => :'calculate_cashout_available', :'has_password' => :'has_password' } end |
.swagger_types ⇒ Object
Attribute type mapping.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 105 def self.swagger_types { :'url' => :'String', :'email' => :'String', :'income' => :'String', :'name' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'business_name' => :'String', :'contractor_type' => :'String', :'accounts' => :'String', :'default_account' => :'String', :'cashouts' => :'String', :'calculate_cashout_available' => :'String', :'has_password' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 225 def ==(o) return true if self.equal?(o) self.class == o.class && url == o.url && email == o.email && income == o.income && name == o.name && first_name == o.first_name && last_name == o.last_name && business_name == o.business_name && contractor_type == o.contractor_type && accounts == o.accounts && default_account == o.default_account && cashouts == o.cashouts && calculate_cashout_available == o.calculate_cashout_available && has_password == o.has_password end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 279 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 :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+), (?<v_type>.+)>\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 else # model temp_model = QwilAPI.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 345 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 |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 258 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 # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
245 246 247 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 245 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
251 252 253 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 251 def hash [url, email, income, name, first_name, last_name, business_name, contractor_type, accounts, default_account, cashouts, calculate_cashout_available, has_password].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
187 188 189 190 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 187 def list_invalid_properties invalid_properties = Array.new return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
325 326 327 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 325 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
331 332 333 334 335 336 337 338 339 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 331 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 |
#to_s ⇒ String
Returns the string representation of the object
319 320 321 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 319 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/qwil_api/models/contractor_serializer.rb', line 194 def valid? return false if @url.nil? return false if @email.nil? return false if @income.nil? return false if @name.nil? return false if @first_name.nil? return false if @last_name.nil? return false if @business_name.nil? return false if @contractor_type.nil? contractor_type_validator = EnumAttributeValidator.new('String', ["INDIVIDUAL", "BUSINESS"]) return false unless contractor_type_validator.valid?(@contractor_type) return false if @accounts.nil? return false if @default_account.nil? return false if @cashouts.nil? return false if @calculate_cashout_available.nil? return false if @has_password.nil? return true end |