Class: Checkbook::Wallet
- Inherits:
-
Object
- Object
- Checkbook::Wallet
- Defined in:
- lib/checkbook/api/wallet.rb,
lib/checkbook/models/wallet.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
-
#balance ⇒ Object
Indicates the current amount left in the wallet’s balance.
-
#date ⇒ Object
Account creation timestamp.
-
#id ⇒ Object
Unique identifier for account.
-
#name ⇒ Object
Name of the wallet.
-
#numbers ⇒ Object
Returns the value of attribute numbers.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#add_wallet(create_wallet_request, opts = {}) ⇒ CreateWalletResponse
Create wallet Add a new wallet account for user > [!NOTE] > Tip > Please securely save the unique routing and account numbers for EXTERNAL wallets after generation, as they are only revealed once.
-
#add_wallet_with_http_info(create_wallet_request, opts = {}) ⇒ Array<(CreateWalletResponse, Integer, Hash)>
Create wallet Add a new wallet account for user > [!NOTE] > Tip > Please securely save the unique routing and account numbers for EXTERNAL wallets after generation, as they are only revealed once.
-
#delete_wallet(wallet_id, opts = {}) ⇒ Object
Delete wallet Delete a wallet account.
-
#delete_wallet_with_http_info(wallet_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete wallet Delete a wallet account.
- #eql?(o) ⇒ Boolean
-
#get_wallet(opts = {}) ⇒ InlineResponse200
Get wallets Get wallet accounts for user.
-
#get_wallet_with_http_info(opts = {}) ⇒ Array<(InlineResponse200, Integer, Hash)>
Get wallets Get wallet accounts for user.
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Wallet
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.
-
#update_wallet(wallet_id, update_wallet_request, opts = {}) ⇒ Object
Update wallet Update wallet.
-
#update_wallet_with_http_info(wallet_id, update_wallet_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Update wallet Update wallet.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/checkbook/api/wallet.rb', line 17 def api_client @api_client end |
#balance ⇒ Object
Indicates the current amount left in the wallet’s balance
19 20 21 |
# File 'lib/checkbook/models/wallet.rb', line 19 def balance @balance end |
#date ⇒ Object
Account creation timestamp
22 23 24 |
# File 'lib/checkbook/models/wallet.rb', line 22 def date @date end |
#id ⇒ Object
Unique identifier for account
25 26 27 |
# File 'lib/checkbook/models/wallet.rb', line 25 def id @id end |
#name ⇒ Object
Name of the wallet
28 29 30 |
# File 'lib/checkbook/models/wallet.rb', line 28 def name @name end |
#numbers ⇒ Object
Returns the value of attribute numbers.
30 31 32 |
# File 'lib/checkbook/models/wallet.rb', line 30 def numbers @numbers end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/checkbook/models/wallet.rb', line 209 def self._deserialize(type, value) case type.to_sym when :Time Time.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 =~ /\A(true|t|yes|y|1)\z/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 # models (e.g. Pet) or oneOf klass = ::Checkbook.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
44 45 46 |
# File 'lib/checkbook/models/wallet.rb', line 44 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
49 50 51 |
# File 'lib/checkbook/models/wallet.rb', line 49 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
33 34 35 36 37 38 39 40 41 |
# File 'lib/checkbook/models/wallet.rb', line 33 def self.attribute_map { :'balance' => :'balance', :'date' => :'date', :'id' => :'id', :'name' => :'name', :'numbers' => :'numbers' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/checkbook/models/wallet.rb', line 185 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_nullable ⇒ Object
List of attributes with nullable: true
65 66 67 68 69 70 |
# File 'lib/checkbook/models/wallet.rb', line 65 def self.openapi_nullable Set.new([ :'balance', :'name', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
54 55 56 57 58 59 60 61 62 |
# File 'lib/checkbook/models/wallet.rb', line 54 def self.openapi_types { :'balance' => :'Float', :'date' => :'String', :'id' => :'String', :'name' => :'String', :'numbers' => :'Numbers' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
160 161 162 163 164 165 166 167 168 |
# File 'lib/checkbook/models/wallet.rb', line 160 def ==(o) return true if self.equal?(o) self.class == o.class && balance == o.balance && date == o.date && id == o.id && name == o.name && numbers == o.numbers end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/checkbook/models/wallet.rb', line 280 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 |
#add_wallet(create_wallet_request, opts = {}) ⇒ CreateWalletResponse
Create wallet Add a new wallet account for user > [!NOTE] > Tip > Please securely save the unique routing and account numbers for EXTERNAL wallets after generation, as they are only revealed once.
27 28 29 30 |
# File 'lib/checkbook/api/wallet.rb', line 27 def add_wallet(create_wallet_request, opts = {}) data, _status_code, _headers = add_wallet_with_http_info(create_wallet_request, opts) data end |
#add_wallet_with_http_info(create_wallet_request, opts = {}) ⇒ Array<(CreateWalletResponse, Integer, Hash)>
Create wallet Add a new wallet account for user > [!NOTE] > Tip > Please securely save the unique routing and account numbers for EXTERNAL wallets after generation, as they are only revealed once.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/checkbook/api/wallet.rb', line 37 def add_wallet_with_http_info(create_wallet_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: Wallet.add_wallet ...' end # verify the required parameter 'create_wallet_request' is set if @api_client.config.client_side_validation && create_wallet_request.nil? fail ArgumentError, "Missing the required parameter 'create_wallet_request' when calling Wallet.add_wallet" end # resource path local_var_path = '/v3/account/wallet' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_wallet_request) # return_type return_type = opts[:debug_return_type] || 'CreateWalletResponse' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"Wallet.add_wallet", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: Wallet#add_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_wallet(wallet_id, opts = {}) ⇒ Object
Delete wallet Delete a wallet account
95 96 97 98 |
# File 'lib/checkbook/api/wallet.rb', line 95 def delete_wallet(wallet_id, opts = {}) data, _status_code, _headers = delete_wallet_with_http_info(wallet_id, opts) data end |
#delete_wallet_with_http_info(wallet_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete wallet Delete a wallet account
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 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 |
# File 'lib/checkbook/api/wallet.rb', line 105 def delete_wallet_with_http_info(wallet_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: Wallet.delete_wallet ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? fail ArgumentError, "Missing the required parameter 'wallet_id' when calling Wallet.delete_wallet" end # resource path local_var_path = '/v3/account/wallet/{wallet_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"Wallet.delete_wallet", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: Wallet#delete_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#eql?(o) ⇒ Boolean
172 173 174 |
# File 'lib/checkbook/models/wallet.rb', line 172 def eql?(o) self == o end |
#get_wallet(opts = {}) ⇒ InlineResponse200
Get wallets Get wallet accounts for user
157 158 159 160 |
# File 'lib/checkbook/api/wallet.rb', line 157 def get_wallet(opts = {}) data, _status_code, _headers = get_wallet_with_http_info(opts) data end |
#get_wallet_with_http_info(opts = {}) ⇒ Array<(InlineResponse200, Integer, Hash)>
Get wallets Get wallet accounts for user
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 |
# File 'lib/checkbook/api/wallet.rb', line 166 def get_wallet_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: Wallet.get_wallet ...' end # resource path local_var_path = '/v3/account/wallet' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'InlineResponse200' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"Wallet.get_wallet", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: Wallet#get_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
178 179 180 |
# File 'lib/checkbook/models/wallet.rb', line 178 def hash [balance, date, id, name, numbers].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/checkbook/models/wallet.rb', line 115 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @date.nil? invalid_properties.push('invalid value for "date", date cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
256 257 258 |
# File 'lib/checkbook/models/wallet.rb', line 256 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/checkbook/models/wallet.rb', line 262 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 |
#to_s ⇒ String
Returns the string representation of the object
250 251 252 |
# File 'lib/checkbook/models/wallet.rb', line 250 def to_s to_hash.to_s end |
#update_wallet(wallet_id, update_wallet_request, opts = {}) ⇒ Object
Update wallet Update wallet
216 217 218 219 |
# File 'lib/checkbook/api/wallet.rb', line 216 def update_wallet(wallet_id, update_wallet_request, opts = {}) data, _status_code, _headers = update_wallet_with_http_info(wallet_id, update_wallet_request, opts) data end |
#update_wallet_with_http_info(wallet_id, update_wallet_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Update wallet Update wallet
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/checkbook/api/wallet.rb', line 227 def update_wallet_with_http_info(wallet_id, update_wallet_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: Wallet.update_wallet ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? fail ArgumentError, "Missing the required parameter 'wallet_id' when calling Wallet.update_wallet" end # verify the required parameter 'update_wallet_request' is set if @api_client.config.client_side_validation && update_wallet_request.nil? fail ArgumentError, "Missing the required parameter 'update_wallet_request' when calling Wallet.update_wallet" end # resource path local_var_path = '/v3/account/wallet/{wallet_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_wallet_request) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"Wallet.update_wallet", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: Wallet#update_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
131 132 133 134 135 136 |
# File 'lib/checkbook/models/wallet.rb', line 131 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @date.nil? return false if @id.nil? true end |