transferzero-sdk 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -15
  3. data/docs/Document.md +5 -1
  4. data/docs/DocumentsApi.md +74 -2
  5. data/docs/PayinMethod.md +4 -4
  6. data/docs/PayinMethodDetails.md +4 -2
  7. data/docs/PayinMethodDetailsNGNBank.md +4 -2
  8. data/docs/PayoutMethod.md +1 -1
  9. data/docs/RecipientsApi.md +2 -2
  10. data/docs/Transaction.md +1 -1
  11. data/docs/TransactionTraits.md +2 -2
  12. data/example/client.rb +14 -14
  13. data/lib/transferzero-sdk.rb +0 -7
  14. data/lib/transferzero-sdk/api/documents_api.rb +63 -0
  15. data/lib/transferzero-sdk/api/recipients_api.rb +2 -2
  16. data/lib/transferzero-sdk/api_client.rb +1 -1
  17. data/lib/transferzero-sdk/models/currency_exchange.rb +1 -2
  18. data/lib/transferzero-sdk/models/currency_opposite.rb +1 -2
  19. data/lib/transferzero-sdk/models/document.rb +20 -1
  20. data/lib/transferzero-sdk/models/document_webhook.rb +0 -1
  21. data/lib/transferzero-sdk/models/payin_method.rb +4 -4
  22. data/lib/transferzero-sdk/models/payin_method_details.rb +12 -7
  23. data/lib/transferzero-sdk/models/payin_method_details_ngn_bank.rb +11 -6
  24. data/lib/transferzero-sdk/models/payout_method.rb +1 -1
  25. data/lib/transferzero-sdk/models/payout_method_webhook.rb +0 -1
  26. data/lib/transferzero-sdk/models/recipient_webhook.rb +0 -1
  27. data/lib/transferzero-sdk/models/sender.rb +1 -1
  28. data/lib/transferzero-sdk/models/sender_state.rb +1 -0
  29. data/lib/transferzero-sdk/models/sender_webhook.rb +0 -1
  30. data/lib/transferzero-sdk/models/transaction.rb +1 -1
  31. data/lib/transferzero-sdk/models/transaction_traits.rb +3 -3
  32. data/lib/transferzero-sdk/models/transaction_webhook.rb +0 -1
  33. data/lib/transferzero-sdk/models/webhook.rb +1 -1
  34. data/lib/transferzero-sdk/version.rb +1 -1
  35. data/spec/api/account_validation_api_spec.rb +2 -2
  36. data/spec/api/currency_info_api_spec.rb +2 -0
  37. data/spec/api/documents_api_spec.rb +15 -0
  38. data/spec/api/recipients_api_spec.rb +1 -1
  39. data/spec/api/transactions_api_spec.rb +13 -0
  40. data/spec/models/account_validation_request_spec.rb +7 -1
  41. data/spec/models/currency_opposite_spec.rb +6 -0
  42. data/spec/models/document_spec.rb +12 -0
  43. data/spec/models/payin_method_details_ngn_bank_spec.rb +6 -0
  44. data/spec/models/payin_method_details_spec.rb +6 -0
  45. data/spec/models/payout_method_details_spec.rb +7 -1
  46. data/spec/models/payout_method_details_xof_bank_spec.rb +1 -1
  47. data/spec/models/recipient_spec.rb +6 -0
  48. data/spec/models/sender_spec.rb +16 -0
  49. data/transferzero-sdk-1.4.0.gem +0 -0
  50. metadata +3 -32
  51. data/docs/CurrencyExchangeAllOf.md +0 -17
  52. data/docs/CurrencyOppositeAllOf.md +0 -19
  53. data/docs/DocumentWebhookAllOf.md +0 -17
  54. data/docs/PayoutMethodWebhookAllOf.md +0 -17
  55. data/docs/RecipientWebhookAllOf.md +0 -17
  56. data/docs/SenderWebhookAllOf.md +0 -17
  57. data/docs/TransactionWebhookAllOf.md +0 -17
  58. data/lib/transferzero-sdk/models/currency_exchange_all_of.rb +0 -204
  59. data/lib/transferzero-sdk/models/currency_opposite_all_of.rb +0 -212
  60. data/lib/transferzero-sdk/models/document_webhook_all_of.rb +0 -201
  61. data/lib/transferzero-sdk/models/payout_method_webhook_all_of.rb +0 -201
  62. data/lib/transferzero-sdk/models/recipient_webhook_all_of.rb +0 -201
  63. data/lib/transferzero-sdk/models/sender_webhook_all_of.rb +0 -201
  64. data/lib/transferzero-sdk/models/transaction_webhook_all_of.rb +0 -201
  65. data/spec/api_client_spec.rb +0 -189
  66. data/spec/models/currency_exchange_all_of_spec.rb +0 -41
  67. data/spec/models/currency_opposite_all_of_spec.rb +0 -41
  68. data/spec/models/document_webhook_all_of_spec.rb +0 -41
  69. data/spec/models/payout_method_webhook_all_of_spec.rb +0 -41
  70. data/spec/models/recipient_webhook_all_of_spec.rb +0 -41
  71. data/spec/models/sender_webhook_all_of_spec.rb +0 -41
  72. data/spec/models/transaction_webhook_all_of_spec.rb +0 -41
@@ -1,201 +0,0 @@
1
- =begin
2
- #TransferZero API
3
-
4
- #Reference documentation for the TransferZero API V1
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.0-beta3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module TransferZero
16
- class SenderWebhookAllOf
17
- attr_accessor :object
18
-
19
- # Attribute mapping from ruby-style variable name to JSON key.
20
- def self.attribute_map
21
- {
22
- :'object' => :'object'
23
- }
24
- end
25
-
26
- # Attribute type mapping.
27
- def self.openapi_types
28
- {
29
- :'object' => :'Sender'
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 `TransferZero::SenderWebhookAllOf` 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 `TransferZero::SenderWebhookAllOf`. 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?(:'object')
49
- self.object = attributes[:'object']
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
- object == o.object
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
- [object].hash
84
- end
85
-
86
- require 'active_support/core_ext/hash'
87
- require 'active_support/hash_with_indifferent_access.rb'
88
- # Builds the object from hash
89
- # @param [Hash] attributes Model attributes in the form of hash
90
- # @return [Object] Returns the model itself
91
- def build_from_hash(attributes)
92
- return nil unless attributes.is_a?(Hash)
93
- self.class.openapi_types.each_pair do |key, type|
94
- if type =~ /\AArray<(.*)>/i
95
- # check to ensure the input is an array given that the the attribute
96
- # is documented as an array but the input is not
97
- if attributes[self.class.attribute_map[key]].is_a?(Array)
98
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
- end
100
- elsif !attributes[self.class.attribute_map[key]].nil?
101
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
- end # or else data not found in attributes(hash), not an issue as the data can be optional
103
- end
104
-
105
- self
106
- end
107
-
108
- # Deserializes the data based on type
109
- # @param string type Data type
110
- # @param string value Value to be deserialized
111
- # @return [Object] Deserialized data
112
- def _deserialize(type, value)
113
- case type.to_sym
114
- when :DateTime
115
- DateTime.parse(value)
116
- when :Date
117
- Date.parse(value)
118
- when :String
119
- value.to_s
120
- when :Integer
121
- value.to_i
122
- when :Float
123
- value.to_f
124
- when :Boolean
125
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
- true
127
- else
128
- false
129
- end
130
- when :Object
131
- # generic object (usually a Hash), return directly
132
- value
133
- when /\AArray<(?<inner_type>.+)>\z/
134
- inner_type = Regexp.last_match[:inner_type]
135
- value.map { |v| _deserialize(inner_type, v) }
136
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
- k_type = Regexp.last_match[:k_type]
138
- v_type = Regexp.last_match[:v_type]
139
- {}.tap do |hash|
140
- value.each do |k, v|
141
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
- end
143
- end
144
- else # model
145
- temp_model = TransferZero.const_get(type).new
146
- temp_model.build_from_hash(value)
147
- end
148
- end
149
-
150
- # Returns the string representation of the object
151
- # @return [String] String presentation of the object
152
- def to_s
153
- to_hash.to_s
154
- end
155
-
156
- # to_body is an alias to to_hash (backward compatibility)
157
- # @return [Hash] Returns the object in the form of hash
158
- def to_body
159
- to_hash
160
- end
161
-
162
- # Returns the object in the form of hash
163
- # @return [Hash] Returns the object in the form of hash
164
- def to_hash
165
- hash = {}
166
- self.class.attribute_map.each_pair do |attr, param|
167
- value = self.send(attr)
168
- next if value.nil?
169
- hash[param] = _to_hash(value)
170
- end
171
- ::ActiveSupport::HashWithIndifferentAccess.new(hash)
172
- end
173
-
174
- def [](key)
175
- to_hash[key]
176
- end
177
-
178
- def dig(*args)
179
- to_hash.dig(*args)
180
- end
181
-
182
- # Outputs non-array value in the form of hash
183
- # For object, use to_hash. Otherwise, just return the value
184
- # @param [Object] value Any valid value
185
- # @return [Hash] Returns the value in the form of hash
186
- def _to_hash(value)
187
- if value.is_a?(Array)
188
- value.compact.map { |v| _to_hash(v) }
189
- elsif value.is_a?(Hash)
190
- {}.tap do |hash|
191
- value.each { |k, v| hash[k] = _to_hash(v) }
192
- end
193
- elsif value.respond_to? :to_hash
194
- value.to_hash
195
- else
196
- value
197
- end
198
- end
199
-
200
- end
201
- end
@@ -1,201 +0,0 @@
1
- =begin
2
- #TransferZero API
3
-
4
- #Reference documentation for the TransferZero API V1
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.0-beta3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module TransferZero
16
- class TransactionWebhookAllOf
17
- attr_accessor :object
18
-
19
- # Attribute mapping from ruby-style variable name to JSON key.
20
- def self.attribute_map
21
- {
22
- :'object' => :'object'
23
- }
24
- end
25
-
26
- # Attribute type mapping.
27
- def self.openapi_types
28
- {
29
- :'object' => :'Transaction'
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 `TransferZero::TransactionWebhookAllOf` 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 `TransferZero::TransactionWebhookAllOf`. 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?(:'object')
49
- self.object = attributes[:'object']
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
- object == o.object
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
- [object].hash
84
- end
85
-
86
- require 'active_support/core_ext/hash'
87
- require 'active_support/hash_with_indifferent_access.rb'
88
- # Builds the object from hash
89
- # @param [Hash] attributes Model attributes in the form of hash
90
- # @return [Object] Returns the model itself
91
- def build_from_hash(attributes)
92
- return nil unless attributes.is_a?(Hash)
93
- self.class.openapi_types.each_pair do |key, type|
94
- if type =~ /\AArray<(.*)>/i
95
- # check to ensure the input is an array given that the the attribute
96
- # is documented as an array but the input is not
97
- if attributes[self.class.attribute_map[key]].is_a?(Array)
98
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
- end
100
- elsif !attributes[self.class.attribute_map[key]].nil?
101
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
- end # or else data not found in attributes(hash), not an issue as the data can be optional
103
- end
104
-
105
- self
106
- end
107
-
108
- # Deserializes the data based on type
109
- # @param string type Data type
110
- # @param string value Value to be deserialized
111
- # @return [Object] Deserialized data
112
- def _deserialize(type, value)
113
- case type.to_sym
114
- when :DateTime
115
- DateTime.parse(value)
116
- when :Date
117
- Date.parse(value)
118
- when :String
119
- value.to_s
120
- when :Integer
121
- value.to_i
122
- when :Float
123
- value.to_f
124
- when :Boolean
125
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
- true
127
- else
128
- false
129
- end
130
- when :Object
131
- # generic object (usually a Hash), return directly
132
- value
133
- when /\AArray<(?<inner_type>.+)>\z/
134
- inner_type = Regexp.last_match[:inner_type]
135
- value.map { |v| _deserialize(inner_type, v) }
136
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
- k_type = Regexp.last_match[:k_type]
138
- v_type = Regexp.last_match[:v_type]
139
- {}.tap do |hash|
140
- value.each do |k, v|
141
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
- end
143
- end
144
- else # model
145
- temp_model = TransferZero.const_get(type).new
146
- temp_model.build_from_hash(value)
147
- end
148
- end
149
-
150
- # Returns the string representation of the object
151
- # @return [String] String presentation of the object
152
- def to_s
153
- to_hash.to_s
154
- end
155
-
156
- # to_body is an alias to to_hash (backward compatibility)
157
- # @return [Hash] Returns the object in the form of hash
158
- def to_body
159
- to_hash
160
- end
161
-
162
- # Returns the object in the form of hash
163
- # @return [Hash] Returns the object in the form of hash
164
- def to_hash
165
- hash = {}
166
- self.class.attribute_map.each_pair do |attr, param|
167
- value = self.send(attr)
168
- next if value.nil?
169
- hash[param] = _to_hash(value)
170
- end
171
- ::ActiveSupport::HashWithIndifferentAccess.new(hash)
172
- end
173
-
174
- def [](key)
175
- to_hash[key]
176
- end
177
-
178
- def dig(*args)
179
- to_hash.dig(*args)
180
- end
181
-
182
- # Outputs non-array value in the form of hash
183
- # For object, use to_hash. Otherwise, just return the value
184
- # @param [Object] value Any valid value
185
- # @return [Hash] Returns the value in the form of hash
186
- def _to_hash(value)
187
- if value.is_a?(Array)
188
- value.compact.map { |v| _to_hash(v) }
189
- elsif value.is_a?(Hash)
190
- {}.tap do |hash|
191
- value.each { |k, v| hash[k] = _to_hash(v) }
192
- end
193
- elsif value.respond_to? :to_hash
194
- value.to_hash
195
- else
196
- value
197
- end
198
- end
199
-
200
- end
201
- end
@@ -1,189 +0,0 @@
1
- =begin
2
- #TransferZero API
3
-
4
- #Reference documentation for the TransferZero API V1
5
-
6
- OpenAPI spec version: 1.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.0-beta2
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe TransferZero::ApiClient do
16
- context 'initialization' do
17
- context 'URL stuff' do
18
- context 'host' do
19
- it 'removes http from host' do
20
- TransferZero.configure { |c| c.host = 'http://example.com' }
21
- expect(TransferZero::Configuration.default.host).to eq('example.com')
22
- end
23
-
24
- it 'removes https from host' do
25
- TransferZero.configure { |c| c.host = 'https://wookiee.com' }
26
- expect(TransferZero::ApiClient.default.config.host).to eq('wookiee.com')
27
- end
28
-
29
- it 'removes trailing path from host' do
30
- TransferZero.configure { |c| c.host = 'hobo.com/v4' }
31
- expect(TransferZero::Configuration.default.host).to eq('hobo.com')
32
- end
33
- end
34
-
35
- context 'base_path' do
36
- it "prepends a slash to base_path" do
37
- TransferZero.configure { |c| c.base_path = 'v4/dog' }
38
- expect(TransferZero::Configuration.default.base_path).to eq('/v4/dog')
39
- end
40
-
41
- it "doesn't prepend a slash if one is already there" do
42
- TransferZero.configure { |c| c.base_path = '/v4/dog' }
43
- expect(TransferZero::Configuration.default.base_path).to eq('/v4/dog')
44
- end
45
-
46
- it "ends up as a blank string if nil" do
47
- TransferZero.configure { |c| c.base_path = nil }
48
- expect(TransferZero::Configuration.default.base_path).to eq('')
49
- end
50
- end
51
- end
52
- end
53
-
54
- describe '#deserialize' do
55
- it "handles Array<Integer>" do
56
- api_client = TransferZero::ApiClient.new
57
- headers = { 'Content-Type' => 'application/json' }
58
- response = double('response', headers: headers, body: '[12, 34]')
59
- data = api_client.deserialize(response, 'Array<Integer>')
60
- expect(data).to be_instance_of(Array)
61
- expect(data).to eq([12, 34])
62
- end
63
-
64
- it 'handles Array<Array<Integer>>' do
65
- api_client = TransferZero::ApiClient.new
66
- headers = { 'Content-Type' => 'application/json' }
67
- response = double('response', headers: headers, body: '[[12, 34], [56]]')
68
- data = api_client.deserialize(response, 'Array<Array<Integer>>')
69
- expect(data).to be_instance_of(Array)
70
- expect(data).to eq([[12, 34], [56]])
71
- end
72
-
73
- it 'handles Hash<String, String>' do
74
- api_client = TransferZero::ApiClient.new
75
- headers = { 'Content-Type' => 'application/json' }
76
- response = double('response', headers: headers, body: '{"message": "Hello"}')
77
- data = api_client.deserialize(response, 'Hash<String, String>')
78
- expect(data).to be_instance_of(Hash)
79
- expect(data).to eq(:message => 'Hello')
80
- end
81
- end
82
-
83
- describe "#object_to_hash" do
84
- it 'ignores nils and includes empty arrays' do
85
- # uncomment below to test object_to_hash for model
86
- # api_client = TransferZero::ApiClient.new
87
- # _model = TransferZero::ModelName.new
88
- # update the model attribute below
89
- # _model.id = 1
90
- # update the expected value (hash) below
91
- # expected = {id: 1, name: '', tags: []}
92
- # expect(api_client.object_to_hash(_model)).to eq(expected)
93
- end
94
- end
95
-
96
- describe '#build_collection_param' do
97
- let(:param) { ['aa', 'bb', 'cc'] }
98
- let(:api_client) { TransferZero::ApiClient.new }
99
-
100
- it 'works for csv' do
101
- expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
102
- end
103
-
104
- it 'works for ssv' do
105
- expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
106
- end
107
-
108
- it 'works for tsv' do
109
- expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
110
- end
111
-
112
- it 'works for pipes' do
113
- expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
114
- end
115
-
116
- it 'works for multi' do
117
- expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
118
- end
119
-
120
- it 'fails for invalid collection format' do
121
- expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
122
- end
123
- end
124
-
125
- describe '#json_mime?' do
126
- let(:api_client) { TransferZero::ApiClient.new }
127
-
128
- it 'works' do
129
- expect(api_client.json_mime?(nil)).to eq false
130
- expect(api_client.json_mime?('')).to eq false
131
-
132
- expect(api_client.json_mime?('application/json')).to eq true
133
- expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
134
- expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
135
-
136
- expect(api_client.json_mime?('application/xml')).to eq false
137
- expect(api_client.json_mime?('text/plain')).to eq false
138
- expect(api_client.json_mime?('application/jsonp')).to eq false
139
- end
140
- end
141
-
142
- describe '#select_header_accept' do
143
- let(:api_client) { TransferZero::ApiClient.new }
144
-
145
- it 'works' do
146
- expect(api_client.select_header_accept(nil)).to be_nil
147
- expect(api_client.select_header_accept([])).to be_nil
148
-
149
- expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
150
- expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
151
- expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
152
-
153
- expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
154
- expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
155
- end
156
- end
157
-
158
- describe '#select_header_content_type' do
159
- let(:api_client) { TransferZero::ApiClient.new }
160
-
161
- it 'works' do
162
- expect(api_client.select_header_content_type(nil)).to eq('application/json')
163
- expect(api_client.select_header_content_type([])).to eq('application/json')
164
-
165
- expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
166
- expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
167
- expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
168
- expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
169
- expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
170
- end
171
- end
172
-
173
- describe '#sanitize_filename' do
174
- let(:api_client) { TransferZero::ApiClient.new }
175
-
176
- it 'works' do
177
- expect(api_client.sanitize_filename('sun')).to eq('sun')
178
- expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
179
- expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
180
- expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
181
- expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
182
- expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
183
- expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
184
- expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
185
- expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
186
- end
187
- end
188
- end
189
-