sky_api 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +190 -0
- data/Rakefile +10 -0
- data/docs/Address.md +17 -0
- data/docs/ApiV1PendingTxsTransaction.md +29 -0
- data/docs/ApiV1PendingTxsTransactionOutputs.md +23 -0
- data/docs/BlockSchema.md +21 -0
- data/docs/BlockSchemaBody.md +17 -0
- data/docs/BlockVerboseSchema.md +21 -0
- data/docs/BlockVerboseSchemaBody.md +17 -0
- data/docs/BlockVerboseSchemaHeader.md +31 -0
- data/docs/DefaultApi.md +2767 -0
- data/docs/InlineResponse200.md +17 -0
- data/docs/InlineResponse2001.md +17 -0
- data/docs/InlineResponse20010.md +25 -0
- data/docs/InlineResponse2002.md +29 -0
- data/docs/InlineResponse2003.md +17 -0
- data/docs/InlineResponse2004.md +17 -0
- data/docs/InlineResponse2005.md +21 -0
- data/docs/InlineResponse2006.md +17 -0
- data/docs/InlineResponse2007.md +17 -0
- data/docs/InlineResponse2008.md +17 -0
- data/docs/InlineResponse2008Data.md +17 -0
- data/docs/InlineResponse2009.md +17 -0
- data/docs/InlineResponseDefault.md +19 -0
- data/docs/NetworkConnectionSchema.md +41 -0
- data/docs/NetworkConnectionSchemaUnconfirmedVerifyTransaction.md +21 -0
- data/docs/Transaction.md +21 -0
- data/docs/TransactionEncoded.md +25 -0
- data/docs/TransactionEncodedS.md +21 -0
- data/docs/TransactionStatus.md +23 -0
- data/docs/TransactionTxn.md +31 -0
- data/docs/TransactionV2ParamsAddress.md +17 -0
- data/docs/TransactionV2ParamsAddressHoursSelection.md +17 -0
- data/docs/TransactionV2ParamsUnspent.md +23 -0
- data/docs/TransactionV2ParamsUnspentHoursSelection.md +21 -0
- data/docs/TransactionV2ParamsUnspentTo.md +19 -0
- data/docs/TransactionVerbose.md +21 -0
- data/docs/TransactionVerboseTxn.md +35 -0
- data/docs/TransactionVerboseTxnInputs.md +25 -0
- data/docs/TransactionVerifyRequest.md +19 -0
- data/docs/WalletTransactionRequest.md +25 -0
- data/docs/WalletTransactionRequestHoursSelection.md +21 -0
- data/docs/WalletTransactionRequestWallet.md +23 -0
- data/docs/WalletTransactionSignRequest.md +23 -0
- data/git_push.sh +55 -0
- data/lib/sky_api.rb +81 -0
- data/lib/sky_api/api/default_api.rb +3371 -0
- data/lib/sky_api/api_client.rb +387 -0
- data/lib/sky_api/api_error.rb +57 -0
- data/lib/sky_api/configuration.rb +259 -0
- data/lib/sky_api/models/address.rb +201 -0
- data/lib/sky_api/models/api_v1_pending_txs_transaction.rb +256 -0
- data/lib/sky_api/models/api_v1_pending_txs_transaction_outputs.rb +223 -0
- data/lib/sky_api/models/block_schema.rb +214 -0
- data/lib/sky_api/models/block_schema_body.rb +198 -0
- data/lib/sky_api/models/block_verbose_schema.rb +214 -0
- data/lib/sky_api/models/block_verbose_schema_body.rb +198 -0
- data/lib/sky_api/models/block_verbose_schema_header.rb +259 -0
- data/lib/sky_api/models/inline_response200.rb +196 -0
- data/lib/sky_api/models/inline_response2001.rb +198 -0
- data/lib/sky_api/models/inline_response20010.rb +232 -0
- data/lib/sky_api/models/inline_response2002.rb +261 -0
- data/lib/sky_api/models/inline_response2003.rb +196 -0
- data/lib/sky_api/models/inline_response2004.rb +198 -0
- data/lib/sky_api/models/inline_response2005.rb +217 -0
- data/lib/sky_api/models/inline_response2006.rb +198 -0
- data/lib/sky_api/models/inline_response2007.rb +196 -0
- data/lib/sky_api/models/inline_response2008.rb +196 -0
- data/lib/sky_api/models/inline_response2008_data.rb +196 -0
- data/lib/sky_api/models/inline_response2009.rb +196 -0
- data/lib/sky_api/models/inline_response_default.rb +205 -0
- data/lib/sky_api/models/network_connection_schema.rb +338 -0
- data/lib/sky_api/models/network_connection_schema_unconfirmed_verify_transaction.rb +215 -0
- data/lib/sky_api/models/transaction.rb +214 -0
- data/lib/sky_api/models/transaction_encoded.rb +232 -0
- data/lib/sky_api/models/transaction_encoded_s.rb +214 -0
- data/lib/sky_api/models/transaction_status.rb +225 -0
- data/lib/sky_api/models/transaction_txn.rb +266 -0
- data/lib/sky_api/models/transaction_v2_params_address.rb +196 -0
- data/lib/sky_api/models/transaction_v2_params_address_hours_selection.rb +196 -0
- data/lib/sky_api/models/transaction_v2_params_unspent.rb +227 -0
- data/lib/sky_api/models/transaction_v2_params_unspent_hours_selection.rb +214 -0
- data/lib/sky_api/models/transaction_v2_params_unspent_to.rb +205 -0
- data/lib/sky_api/models/transaction_verbose.rb +214 -0
- data/lib/sky_api/models/transaction_verbose_txn.rb +284 -0
- data/lib/sky_api/models/transaction_verbose_txn_inputs.rb +232 -0
- data/lib/sky_api/models/transaction_verify_request.rb +205 -0
- data/lib/sky_api/models/wallet_transaction_request.rb +234 -0
- data/lib/sky_api/models/wallet_transaction_request_hours_selection.rb +214 -0
- data/lib/sky_api/models/wallet_transaction_request_wallet.rb +227 -0
- data/lib/sky_api/models/wallet_transaction_sign_request.rb +225 -0
- data/lib/sky_api/version.rb +15 -0
- data/sky_api.gemspec +45 -0
- data/spec/api/default_api_spec.rb +652 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/address_spec.rb +41 -0
- data/spec/models/api_v1_pending_txs_transaction_outputs_spec.rb +59 -0
- data/spec/models/api_v1_pending_txs_transaction_spec.rb +77 -0
- data/spec/models/block_schema_body_spec.rb +41 -0
- data/spec/models/block_schema_spec.rb +53 -0
- data/spec/models/block_verbose_schema_body_spec.rb +41 -0
- data/spec/models/block_verbose_schema_header_spec.rb +83 -0
- data/spec/models/block_verbose_schema_spec.rb +53 -0
- data/spec/models/inline_response20010_spec.rb +65 -0
- data/spec/models/inline_response2001_spec.rb +41 -0
- data/spec/models/inline_response2002_spec.rb +77 -0
- data/spec/models/inline_response2003_spec.rb +41 -0
- data/spec/models/inline_response2004_spec.rb +41 -0
- data/spec/models/inline_response2005_spec.rb +53 -0
- data/spec/models/inline_response2006_spec.rb +41 -0
- data/spec/models/inline_response2007_spec.rb +41 -0
- data/spec/models/inline_response2008_data_spec.rb +41 -0
- data/spec/models/inline_response2008_spec.rb +41 -0
- data/spec/models/inline_response2009_spec.rb +41 -0
- data/spec/models/inline_response200_spec.rb +41 -0
- data/spec/models/inline_response_default_spec.rb +47 -0
- data/spec/models/network_connection_schema_spec.rb +117 -0
- data/spec/models/network_connection_schema_unconfirmed_verify_transaction_spec.rb +53 -0
- data/spec/models/transaction_encoded_s_spec.rb +53 -0
- data/spec/models/transaction_encoded_spec.rb +65 -0
- data/spec/models/transaction_spec.rb +53 -0
- data/spec/models/transaction_status_spec.rb +59 -0
- data/spec/models/transaction_txn_spec.rb +83 -0
- data/spec/models/transaction_v2_params_address_hours_selection_spec.rb +41 -0
- data/spec/models/transaction_v2_params_address_spec.rb +41 -0
- data/spec/models/transaction_v2_params_unspent_hours_selection_spec.rb +53 -0
- data/spec/models/transaction_v2_params_unspent_spec.rb +59 -0
- data/spec/models/transaction_v2_params_unspent_to_spec.rb +47 -0
- data/spec/models/transaction_verbose_spec.rb +53 -0
- data/spec/models/transaction_verbose_txn_inputs_spec.rb +65 -0
- data/spec/models/transaction_verbose_txn_spec.rb +95 -0
- data/spec/models/transaction_verify_request_spec.rb +47 -0
- data/spec/models/wallet_transaction_request_hours_selection_spec.rb +53 -0
- data/spec/models/wallet_transaction_request_spec.rb +65 -0
- data/spec/models/wallet_transaction_request_wallet_spec.rb +59 -0
- data/spec/models/wallet_transaction_sign_request_spec.rb +59 -0
- data/spec/spec_helper.rb +111 -0
- metadata +407 -0
@@ -0,0 +1,196 @@
|
|
1
|
+
=begin
|
2
|
+
#Skycoin REST API.
|
3
|
+
|
4
|
+
#Skycoin is a next-generation cryptocurrency.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.26.0
|
7
|
+
Contact: contact@skycoin.net
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SkyApi
|
16
|
+
class TransactionV2ParamsAddress
|
17
|
+
attr_accessor :hours_selection
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'hours_selection' => :'hours_selection'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.openapi_types
|
28
|
+
{
|
29
|
+
:'hours_selection' => :'TransactionV2ParamsAddressHoursSelection'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
if (!attributes.is_a?(Hash))
|
37
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SkyApi::TransactionV2ParamsAddress` initialize method"
|
38
|
+
end
|
39
|
+
|
40
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
42
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
43
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SkyApi::TransactionV2ParamsAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
44
|
+
end
|
45
|
+
h[k.to_sym] = v
|
46
|
+
}
|
47
|
+
|
48
|
+
if attributes.key?(:'hours_selection')
|
49
|
+
self.hours_selection = attributes[:'hours_selection']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
54
|
+
# @return Array for valid properties with the reasons
|
55
|
+
def list_invalid_properties
|
56
|
+
invalid_properties = Array.new
|
57
|
+
invalid_properties
|
58
|
+
end
|
59
|
+
|
60
|
+
# Check to see if the all the properties in the model are valid
|
61
|
+
# @return true if the model is valid
|
62
|
+
def valid?
|
63
|
+
true
|
64
|
+
end
|
65
|
+
|
66
|
+
# Checks equality by comparing each attribute.
|
67
|
+
# @param [Object] Object to be compared
|
68
|
+
def ==(o)
|
69
|
+
return true if self.equal?(o)
|
70
|
+
self.class == o.class &&
|
71
|
+
hours_selection == o.hours_selection
|
72
|
+
end
|
73
|
+
|
74
|
+
# @see the `==` method
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def eql?(o)
|
77
|
+
self == o
|
78
|
+
end
|
79
|
+
|
80
|
+
# Calculates hash code according to all attributes.
|
81
|
+
# @return [Integer] Hash code
|
82
|
+
def hash
|
83
|
+
[hours_selection].hash
|
84
|
+
end
|
85
|
+
|
86
|
+
# Builds the object from hash
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
# @return [Object] Returns the model itself
|
89
|
+
def self.build_from_hash(attributes)
|
90
|
+
new.build_from_hash(attributes)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def build_from_hash(attributes)
|
97
|
+
return nil unless attributes.is_a?(Hash)
|
98
|
+
self.class.openapi_types.each_pair do |key, type|
|
99
|
+
if type =~ /\AArray<(.*)>/i
|
100
|
+
# check to ensure the input is an array given that the attribute
|
101
|
+
# is documented as an array but the input is not
|
102
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
104
|
+
end
|
105
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
107
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
108
|
+
end
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
# Deserializes the data based on type
|
114
|
+
# @param string type Data type
|
115
|
+
# @param string value Value to be deserialized
|
116
|
+
# @return [Object] Deserialized data
|
117
|
+
def _deserialize(type, value)
|
118
|
+
case type.to_sym
|
119
|
+
when :DateTime
|
120
|
+
DateTime.parse(value)
|
121
|
+
when :Date
|
122
|
+
Date.parse(value)
|
123
|
+
when :String
|
124
|
+
value.to_s
|
125
|
+
when :Integer
|
126
|
+
value.to_i
|
127
|
+
when :Float
|
128
|
+
value.to_f
|
129
|
+
when :Boolean
|
130
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
131
|
+
true
|
132
|
+
else
|
133
|
+
false
|
134
|
+
end
|
135
|
+
when :Object
|
136
|
+
# generic object (usually a Hash), return directly
|
137
|
+
value
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
141
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
144
|
+
{}.tap do |hash|
|
145
|
+
value.each do |k, v|
|
146
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
else # model
|
150
|
+
SkyApi.const_get(type).build_from_hash(value)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# Returns the string representation of the object
|
155
|
+
# @return [String] String presentation of the object
|
156
|
+
def to_s
|
157
|
+
to_hash.to_s
|
158
|
+
end
|
159
|
+
|
160
|
+
# to_body is an alias to to_hash (backward compatibility)
|
161
|
+
# @return [Hash] Returns the object in the form of hash
|
162
|
+
def to_body
|
163
|
+
to_hash
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the object in the form of hash
|
167
|
+
# @return [Hash] Returns the object in the form of hash
|
168
|
+
def to_hash
|
169
|
+
hash = {}
|
170
|
+
self.class.attribute_map.each_pair do |attr, param|
|
171
|
+
value = self.send(attr)
|
172
|
+
next if value.nil?
|
173
|
+
hash[param] = _to_hash(value)
|
174
|
+
end
|
175
|
+
hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Outputs non-array value in the form of hash
|
179
|
+
# For object, use to_hash. Otherwise, just return the value
|
180
|
+
# @param [Object] value Any valid value
|
181
|
+
# @return [Hash] Returns the value in the form of hash
|
182
|
+
def _to_hash(value)
|
183
|
+
if value.is_a?(Array)
|
184
|
+
value.compact.map { |v| _to_hash(v) }
|
185
|
+
elsif value.is_a?(Hash)
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
188
|
+
end
|
189
|
+
elsif value.respond_to? :to_hash
|
190
|
+
value.to_hash
|
191
|
+
else
|
192
|
+
value
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
=begin
|
2
|
+
#Skycoin REST API.
|
3
|
+
|
4
|
+
#Skycoin is a next-generation cryptocurrency.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.26.0
|
7
|
+
Contact: contact@skycoin.net
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SkyApi
|
16
|
+
class TransactionV2ParamsAddressHoursSelection
|
17
|
+
attr_accessor :type
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'type' => :'type'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.openapi_types
|
28
|
+
{
|
29
|
+
:'type' => :'String'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
if (!attributes.is_a?(Hash))
|
37
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SkyApi::TransactionV2ParamsAddressHoursSelection` initialize method"
|
38
|
+
end
|
39
|
+
|
40
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
42
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
43
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SkyApi::TransactionV2ParamsAddressHoursSelection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
44
|
+
end
|
45
|
+
h[k.to_sym] = v
|
46
|
+
}
|
47
|
+
|
48
|
+
if attributes.key?(:'type')
|
49
|
+
self.type = attributes[:'type']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
54
|
+
# @return Array for valid properties with the reasons
|
55
|
+
def list_invalid_properties
|
56
|
+
invalid_properties = Array.new
|
57
|
+
invalid_properties
|
58
|
+
end
|
59
|
+
|
60
|
+
# Check to see if the all the properties in the model are valid
|
61
|
+
# @return true if the model is valid
|
62
|
+
def valid?
|
63
|
+
true
|
64
|
+
end
|
65
|
+
|
66
|
+
# Checks equality by comparing each attribute.
|
67
|
+
# @param [Object] Object to be compared
|
68
|
+
def ==(o)
|
69
|
+
return true if self.equal?(o)
|
70
|
+
self.class == o.class &&
|
71
|
+
type == o.type
|
72
|
+
end
|
73
|
+
|
74
|
+
# @see the `==` method
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def eql?(o)
|
77
|
+
self == o
|
78
|
+
end
|
79
|
+
|
80
|
+
# Calculates hash code according to all attributes.
|
81
|
+
# @return [Integer] Hash code
|
82
|
+
def hash
|
83
|
+
[type].hash
|
84
|
+
end
|
85
|
+
|
86
|
+
# Builds the object from hash
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
# @return [Object] Returns the model itself
|
89
|
+
def self.build_from_hash(attributes)
|
90
|
+
new.build_from_hash(attributes)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def build_from_hash(attributes)
|
97
|
+
return nil unless attributes.is_a?(Hash)
|
98
|
+
self.class.openapi_types.each_pair do |key, type|
|
99
|
+
if type =~ /\AArray<(.*)>/i
|
100
|
+
# check to ensure the input is an array given that the attribute
|
101
|
+
# is documented as an array but the input is not
|
102
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
104
|
+
end
|
105
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
107
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
108
|
+
end
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
# Deserializes the data based on type
|
114
|
+
# @param string type Data type
|
115
|
+
# @param string value Value to be deserialized
|
116
|
+
# @return [Object] Deserialized data
|
117
|
+
def _deserialize(type, value)
|
118
|
+
case type.to_sym
|
119
|
+
when :DateTime
|
120
|
+
DateTime.parse(value)
|
121
|
+
when :Date
|
122
|
+
Date.parse(value)
|
123
|
+
when :String
|
124
|
+
value.to_s
|
125
|
+
when :Integer
|
126
|
+
value.to_i
|
127
|
+
when :Float
|
128
|
+
value.to_f
|
129
|
+
when :Boolean
|
130
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
131
|
+
true
|
132
|
+
else
|
133
|
+
false
|
134
|
+
end
|
135
|
+
when :Object
|
136
|
+
# generic object (usually a Hash), return directly
|
137
|
+
value
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
141
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
144
|
+
{}.tap do |hash|
|
145
|
+
value.each do |k, v|
|
146
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
else # model
|
150
|
+
SkyApi.const_get(type).build_from_hash(value)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# Returns the string representation of the object
|
155
|
+
# @return [String] String presentation of the object
|
156
|
+
def to_s
|
157
|
+
to_hash.to_s
|
158
|
+
end
|
159
|
+
|
160
|
+
# to_body is an alias to to_hash (backward compatibility)
|
161
|
+
# @return [Hash] Returns the object in the form of hash
|
162
|
+
def to_body
|
163
|
+
to_hash
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the object in the form of hash
|
167
|
+
# @return [Hash] Returns the object in the form of hash
|
168
|
+
def to_hash
|
169
|
+
hash = {}
|
170
|
+
self.class.attribute_map.each_pair do |attr, param|
|
171
|
+
value = self.send(attr)
|
172
|
+
next if value.nil?
|
173
|
+
hash[param] = _to_hash(value)
|
174
|
+
end
|
175
|
+
hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Outputs non-array value in the form of hash
|
179
|
+
# For object, use to_hash. Otherwise, just return the value
|
180
|
+
# @param [Object] value Any valid value
|
181
|
+
# @return [Hash] Returns the value in the form of hash
|
182
|
+
def _to_hash(value)
|
183
|
+
if value.is_a?(Array)
|
184
|
+
value.compact.map { |v| _to_hash(v) }
|
185
|
+
elsif value.is_a?(Hash)
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
188
|
+
end
|
189
|
+
elsif value.respond_to? :to_hash
|
190
|
+
value.to_hash
|
191
|
+
else
|
192
|
+
value
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
=begin
|
2
|
+
#Skycoin REST API.
|
3
|
+
|
4
|
+
#Skycoin is a next-generation cryptocurrency.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.26.0
|
7
|
+
Contact: contact@skycoin.net
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SkyApi
|
16
|
+
class TransactionV2ParamsUnspent
|
17
|
+
attr_accessor :hours_selection
|
18
|
+
|
19
|
+
attr_accessor :unspents
|
20
|
+
|
21
|
+
attr_accessor :change_address
|
22
|
+
|
23
|
+
attr_accessor :to
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'hours_selection' => :'hours_selection',
|
29
|
+
:'unspents' => :'unspents',
|
30
|
+
:'change_address' => :'change_address',
|
31
|
+
:'to' => :'to'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'hours_selection' => :'TransactionV2ParamsUnspentHoursSelection',
|
39
|
+
:'unspents' => :'Array<String>',
|
40
|
+
:'change_address' => :'String',
|
41
|
+
:'to' => :'Array<TransactionV2ParamsUnspentTo>'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SkyApi::TransactionV2ParamsUnspent` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SkyApi::TransactionV2ParamsUnspent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'hours_selection')
|
61
|
+
self.hours_selection = attributes[:'hours_selection']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'unspents')
|
65
|
+
if (value = attributes[:'unspents']).is_a?(Array)
|
66
|
+
self.unspents = value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'change_address')
|
71
|
+
self.change_address = attributes[:'change_address']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'to')
|
75
|
+
if (value = attributes[:'to']).is_a?(Array)
|
76
|
+
self.to = value
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
+
# @return Array for valid properties with the reasons
|
83
|
+
def list_invalid_properties
|
84
|
+
invalid_properties = Array.new
|
85
|
+
invalid_properties
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check to see if the all the properties in the model are valid
|
89
|
+
# @return true if the model is valid
|
90
|
+
def valid?
|
91
|
+
true
|
92
|
+
end
|
93
|
+
|
94
|
+
# Checks equality by comparing each attribute.
|
95
|
+
# @param [Object] Object to be compared
|
96
|
+
def ==(o)
|
97
|
+
return true if self.equal?(o)
|
98
|
+
self.class == o.class &&
|
99
|
+
hours_selection == o.hours_selection &&
|
100
|
+
unspents == o.unspents &&
|
101
|
+
change_address == o.change_address &&
|
102
|
+
to == o.to
|
103
|
+
end
|
104
|
+
|
105
|
+
# @see the `==` method
|
106
|
+
# @param [Object] Object to be compared
|
107
|
+
def eql?(o)
|
108
|
+
self == o
|
109
|
+
end
|
110
|
+
|
111
|
+
# Calculates hash code according to all attributes.
|
112
|
+
# @return [Integer] Hash code
|
113
|
+
def hash
|
114
|
+
[hours_selection, unspents, change_address, to].hash
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def self.build_from_hash(attributes)
|
121
|
+
new.build_from_hash(attributes)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def build_from_hash(attributes)
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
129
|
+
self.class.openapi_types.each_pair do |key, type|
|
130
|
+
if type =~ /\AArray<(.*)>/i
|
131
|
+
# check to ensure the input is an array given that the attribute
|
132
|
+
# is documented as an array but the input is not
|
133
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
135
|
+
end
|
136
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
137
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
138
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
139
|
+
end
|
140
|
+
|
141
|
+
self
|
142
|
+
end
|
143
|
+
|
144
|
+
# Deserializes the data based on type
|
145
|
+
# @param string type Data type
|
146
|
+
# @param string value Value to be deserialized
|
147
|
+
# @return [Object] Deserialized data
|
148
|
+
def _deserialize(type, value)
|
149
|
+
case type.to_sym
|
150
|
+
when :DateTime
|
151
|
+
DateTime.parse(value)
|
152
|
+
when :Date
|
153
|
+
Date.parse(value)
|
154
|
+
when :String
|
155
|
+
value.to_s
|
156
|
+
when :Integer
|
157
|
+
value.to_i
|
158
|
+
when :Float
|
159
|
+
value.to_f
|
160
|
+
when :Boolean
|
161
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
162
|
+
true
|
163
|
+
else
|
164
|
+
false
|
165
|
+
end
|
166
|
+
when :Object
|
167
|
+
# generic object (usually a Hash), return directly
|
168
|
+
value
|
169
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
170
|
+
inner_type = Regexp.last_match[:inner_type]
|
171
|
+
value.map { |v| _deserialize(inner_type, v) }
|
172
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
173
|
+
k_type = Regexp.last_match[:k_type]
|
174
|
+
v_type = Regexp.last_match[:v_type]
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each do |k, v|
|
177
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
else # model
|
181
|
+
SkyApi.const_get(type).build_from_hash(value)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the string representation of the object
|
186
|
+
# @return [String] String presentation of the object
|
187
|
+
def to_s
|
188
|
+
to_hash.to_s
|
189
|
+
end
|
190
|
+
|
191
|
+
# to_body is an alias to to_hash (backward compatibility)
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_body
|
194
|
+
to_hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the object in the form of hash
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_hash
|
200
|
+
hash = {}
|
201
|
+
self.class.attribute_map.each_pair do |attr, param|
|
202
|
+
value = self.send(attr)
|
203
|
+
next if value.nil?
|
204
|
+
hash[param] = _to_hash(value)
|
205
|
+
end
|
206
|
+
hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Outputs non-array value in the form of hash
|
210
|
+
# For object, use to_hash. Otherwise, just return the value
|
211
|
+
# @param [Object] value Any valid value
|
212
|
+
# @return [Hash] Returns the value in the form of hash
|
213
|
+
def _to_hash(value)
|
214
|
+
if value.is_a?(Array)
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
216
|
+
elsif value.is_a?(Hash)
|
217
|
+
{}.tap do |hash|
|
218
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
219
|
+
end
|
220
|
+
elsif value.respond_to? :to_hash
|
221
|
+
value.to_hash
|
222
|
+
else
|
223
|
+
value
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|