tangocard-raas 1.1.2 → 2.2.1

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/LICENSE +28 -175
  3. data/README.md +38 -525
  4. data/lib/raas.rb +32 -19
  5. data/lib/raas/api_helper.rb +146 -54
  6. data/lib/raas/configuration.rb +22 -30
  7. data/lib/raas/controllers/accounts_controller.rb +146 -92
  8. data/lib/raas/controllers/base_controller.rb +32 -29
  9. data/lib/raas/controllers/catalog_controller.rb +31 -14
  10. data/lib/raas/controllers/customers_controller.rb +113 -72
  11. data/lib/raas/controllers/exchange_rates_controller.rb +40 -12
  12. data/lib/raas/controllers/fund_controller.rb +345 -0
  13. data/lib/raas/controllers/orders_controller.rb +166 -105
  14. data/lib/raas/controllers/status_controller.rb +31 -14
  15. data/lib/raas/exceptions/api_exception.rb +4 -2
  16. data/lib/raas/exceptions/raas_client_exception.rb +14 -12
  17. data/lib/raas/exceptions/raas_generic_exception.rb +9 -9
  18. data/lib/raas/exceptions/raas_server_exception.rb +14 -12
  19. data/lib/raas/http/auth/basic_auth.rb +7 -4
  20. data/lib/raas/http/faraday_client.rb +19 -7
  21. data/lib/raas/http/http_call_back.rb +11 -6
  22. data/lib/raas/http/http_client.rb +50 -32
  23. data/lib/raas/http/http_context.rb +5 -2
  24. data/lib/raas/http/http_method_enum.rb +6 -2
  25. data/lib/raas/http/http_request.rb +7 -3
  26. data/lib/raas/http/http_response.rb +3 -1
  27. data/lib/raas/models/account_model.rb +32 -23
  28. data/lib/raas/models/account_summary_model.rb +26 -17
  29. data/lib/raas/models/base_model.rb +11 -9
  30. data/lib/raas/models/billing_address_model.rb +105 -0
  31. data/lib/raas/models/brand_model.rb +39 -35
  32. data/lib/raas/models/catalog_model.rb +15 -13
  33. data/lib/raas/models/create_account_request_model.rb +14 -14
  34. data/lib/raas/models/create_credit_card_request_model.rb +96 -0
  35. data/lib/raas/models/create_customer_request_model.rb +12 -12
  36. data/lib/raas/models/create_order_request_model.rb +45 -35
  37. data/lib/raas/models/credit_card_model.rb +124 -0
  38. data/lib/raas/models/currency_breakdown_model.rb +18 -18
  39. data/lib/raas/models/customer_model.rb +24 -22
  40. data/lib/raas/models/deposit_request_model.rb +60 -0
  41. data/lib/raas/models/deposit_response_model.rb +80 -0
  42. data/lib/raas/models/exchange_rate_model.rb +18 -17
  43. data/lib/raas/models/exchange_rate_response_model.rb +17 -15
  44. data/lib/raas/models/full_name_email_model.rb +42 -0
  45. data/lib/raas/models/get_deposit_response_model.rb +80 -0
  46. data/lib/raas/models/get_orders_response_model.rb +16 -14
  47. data/lib/raas/models/item_model.rb +36 -34
  48. data/lib/raas/models/name_email_model.rb +14 -14
  49. data/lib/raas/models/new_credit_card_model.rb +51 -0
  50. data/lib/raas/models/order_model.rb +124 -92
  51. data/lib/raas/models/order_summary_model.rb +155 -0
  52. data/lib/raas/models/page_model.rb +16 -16
  53. data/lib/raas/models/raas_client_error_model.rb +16 -16
  54. data/lib/raas/models/raas_server_error_model.rb +12 -12
  55. data/lib/raas/models/resend_order_response_model.rb +11 -11
  56. data/lib/raas/models/reward_credential_model.rb +14 -14
  57. data/lib/raas/models/reward_model.rb +16 -14
  58. data/lib/raas/models/system_status_response_model.rb +10 -10
  59. data/lib/raas/models/unregister_credit_card_request_model.rb +51 -0
  60. data/lib/raas/models/unregister_credit_card_response_model.rb +53 -0
  61. data/lib/raas/raas_client.rb +36 -25
  62. data/test/controllers/controller_test_base.rb +31 -0
  63. data/test/controllers/test_accounts_controller.rb +79 -0
  64. data/test/controllers/test_catalog_controller.rb +65 -0
  65. data/test/controllers/test_customers_controller.rb +61 -0
  66. data/test/controllers/test_exchange_rates_controller.rb +35 -0
  67. data/test/controllers/test_fund_controller.rb +108 -0
  68. data/test/controllers/test_orders_controller.rb +86 -0
  69. data/test/controllers/test_status_controller.rb +27 -0
  70. data/test/http_response_catcher.rb +16 -0
  71. data/test/test_helper.rb +91 -0
  72. metadata +32 -10
@@ -1,7 +1,9 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  require 'date'
4
5
  module Raas
6
+ # RaaS API Generic Exception
5
7
  class RaasGenericException < APIException
6
8
  # Request timestamp
7
9
  # @return [DateTime]
@@ -28,21 +30,19 @@ module Raas
28
30
  attr_accessor :message
29
31
 
30
32
  # The constructor.
31
- # @param [String] The reason for raising an exception
33
+ # @param [String] The reason for raising an exception.
32
34
  # @param [HttpContext] The HttpContext of the API call.
33
35
  def initialize(reason, context)
34
36
  super(reason, context)
35
- begin
36
- hash = APIHelper.json_deserialize(@context.response.raw_body)
37
- unbox(hash)
38
- rescue TypeError
39
- end
37
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
38
+ unbox(hash)
40
39
  end
41
40
 
42
41
  # Populates this object by extracting properties from a hash.
43
- # @param [Hash] The deserialized response sent by the server in the response body.
42
+ # @param [Hash] The deserialized response sent by the server in the
43
+ # response body.
44
44
  def unbox(hash)
45
- @timestamp = DateTime.rfc3339(hash['timestamp']) if hash['timestamp']
45
+ @timestamp = APIHelper.rfc3339(hash['timestamp']) if hash['timestamp']
46
46
  @request_id = hash['requestId']
47
47
  @path = hash['path']
48
48
  @http_code = hash['httpCode']
@@ -1,7 +1,9 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  require 'date'
4
5
  module Raas
6
+ # RaaS API 5xx Exception
5
7
  class RaasServerException < APIException
6
8
  # Request timestamp
7
9
  # @return [DateTime]
@@ -28,30 +30,30 @@ module Raas
28
30
  attr_accessor :errors
29
31
 
30
32
  # The constructor.
31
- # @param [String] The reason for raising an exception
33
+ # @param [String] The reason for raising an exception.
32
34
  # @param [HttpContext] The HttpContext of the API call.
33
35
  def initialize(reason, context)
34
36
  super(reason, context)
35
- begin
36
- hash = APIHelper.json_deserialize(@context.response.raw_body)
37
- unbox(hash)
38
- rescue TypeError
39
- end
37
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
38
+ unbox(hash)
40
39
  end
41
40
 
42
41
  # Populates this object by extracting properties from a hash.
43
- # @param [Hash] The deserialized response sent by the server in the response body.
42
+ # @param [Hash] The deserialized response sent by the server in the
43
+ # response body.
44
44
  def unbox(hash)
45
- @timestamp = DateTime.rfc3339(hash['timestamp']) if hash['timestamp']
45
+ @timestamp = APIHelper.rfc3339(hash['timestamp']) if hash['timestamp']
46
46
  @request_id = hash['requestId']
47
47
  @path = hash['path']
48
48
  @http_code = hash['httpCode']
49
49
  @http_phrase = hash['httpPhrase']
50
50
  # Parameter is an array, so we need to iterate through it
51
51
  @errors = nil
52
- if hash['errors'] != nil
53
- @errors = Array.new
54
- hash['errors'].each{|structure| @errors << (RaasServerErrorModel.from_hash(structure) if structure)}
52
+ unless hash['errors'].nil?
53
+ @errors = []
54
+ hash['errors'].each do |structure|
55
+ @errors << (RaasServerErrorModel.from_hash(structure) if structure)
56
+ end
55
57
  end
56
58
  end
57
59
  end
@@ -1,17 +1,20 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
- require "base64"
4
+ require 'base64'
4
5
 
5
6
  module Raas
7
+ # Utility class for basic authorization.
6
8
  class BasicAuth
7
9
  # Add basic authentication to the request.
8
- # @param [HttpRequest] The HttpRequest object to which authentication will be added.
10
+ # @param [HttpRequest] The HttpRequest object to which authentication will
11
+ # be added.
9
12
  def self.apply(http_request)
10
13
  username = Configuration.platform_name
11
14
  password = Configuration.platform_key
12
15
  value = Base64.strict_encode64("#{username}:#{password}")
13
16
  header_value = "Basic #{value}"
14
- http_request.headers["Authorization"] = header_value
17
+ http_request.headers['Authorization'] = header_value
15
18
  end
16
19
  end
17
20
  end
@@ -1,10 +1,13 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
  require 'faraday/http_cache'
3
4
 
4
5
  module Raas
6
+ # An implementation of HttpClient.
5
7
  class FaradayClient < HttpClient
6
8
  # The constructor.
7
- def initialize(timeout: nil, cache: false, max_retries: nil, retry_interval: nil)
9
+ def initialize(timeout: nil, cache: false,
10
+ max_retries: nil, retry_interval: nil)
8
11
  @connection = Faraday.new do |faraday|
9
12
  faraday.use Faraday::HttpCache, serializer: Marshal if cache
10
13
  faraday.request :multipart
@@ -13,26 +16,35 @@ module Raas
13
16
  faraday.adapter Faraday.default_adapter
14
17
  faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
15
18
  faraday.options[:open_timeout] = timeout if timeout
16
- faraday.request :retry, max: max_retries, interval: retry_interval if (max_retries && retry_interval)
19
+ faraday.request :retry, max: max_retries, interval: if max_retries &&
20
+ retry_interval
21
+ retry_interval
22
+ end
17
23
  end
18
24
  end
19
25
 
20
26
  # Method overridden from HttpClient.
21
27
  def execute_as_string(http_request)
22
- response = @connection.send(http_request.http_method.downcase, http_request.query_url) do |request|
28
+ response = @connection.send(
29
+ http_request.http_method.downcase,
30
+ http_request.query_url
31
+ ) do |request|
23
32
  request.headers = http_request.headers
24
33
  request.body = http_request.parameters
25
34
  end
26
- return convert_response(response)
35
+ convert_response(response)
27
36
  end
28
37
 
29
38
  # Method overridden from HttpClient.
30
39
  def execute_as_binary(http_request)
31
- response = @connection.send(http_request.http_method.downcase, http_request.query_url) do |request|
40
+ response = @connection.send(
41
+ http_request.http_method.downcase,
42
+ http_request.query_url
43
+ ) do |request|
32
44
  request.headers = http_request.headers
33
45
  request.body = http_request.parameters
34
46
  end
35
- return convert_response(response)
47
+ convert_response(response)
36
48
  end
37
49
 
38
50
  # Method overridden from HttpClient.
@@ -1,17 +1,22 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module Raas
5
+ # HttpCallBack allows defining callables for pre and post API calls.
4
6
  class HttpCallBack
5
7
  # A controller will call this method before making an HTTP Request.
6
- # @param [HttpRequest] The HttpRequest object which the HttpClient will execute.
7
- def on_before_request(http_request)
8
- raise NotImplementedError, 'This method needs to be implemented in a child class.'
8
+ # @param [HttpRequest] The HttpRequest object which the HttpClient
9
+ # will execute.
10
+ def on_before_request(_http_request)
11
+ raise NotImplementedError, 'This method needs
12
+ to be implemented in a child class.'
9
13
  end
10
14
 
11
15
  # A controller will call this method after making an HTTP Request.
12
16
  # @param [HttpContext] The HttpContext of the API call.
13
- def on_after_response(http_context)
14
- raise NotImplementedError, 'This method needs to be implemented in a child class.'
17
+ def on_after_response(_http_context)
18
+ raise NotImplementedError, 'This method needs
19
+ to be implemented in a child class.'
15
20
  end
16
21
  end
17
22
  end
@@ -1,23 +1,31 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module Raas
5
+ # An interface for the methods that an HTTP Client must implement.
6
+ #
7
+ # This class should not be instantiated but should be used as a base class
8
+ # for HTTP Client classes.
4
9
  class HttpClient
5
10
  # Execute an HttpRequest when the response is expected to be a string.
6
11
  # @param [HttpRequest] The HttpRequest to be executed.
7
- def execute_as_string(http_request)
8
- raise NotImplementedError, 'This method needs to be implemented in a child class.'
12
+ def execute_as_string(_http_request)
13
+ raise NotImplementedError, 'This method needs
14
+ to be implemented in a child class.'
9
15
  end
10
-
16
+
11
17
  # Execute an HttpRequest when the response is expected to be binary.
12
18
  # @param [HttpRequest] The HttpRequest to be executed.
13
- def execute_as_binary(http_request)
14
- raise NotImplementedError, 'This method needs to be implemented in a child class.'
19
+ def execute_as_binary(_http_request)
20
+ raise NotImplementedError, 'This method needs
21
+ to be implemented in a child class.'
15
22
  end
16
-
23
+
17
24
  # Converts the HTTP Response from the client to an HttpResponse object.
18
25
  # @param [Dynamic] The response object received from the client.
19
- def convert_response(response)
20
- raise NotImplementedError, 'This method needs to be implemented in a child class.'
26
+ def convert_response(_response)
27
+ raise NotImplementedError, 'This method needs
28
+ to be implemented in a child class.'
21
29
  end
22
30
 
23
31
  # Get a GET HttpRequest object.
@@ -25,11 +33,21 @@ module Raas
25
33
  # @param [Hash, Optional] The headers for the HTTP Request.
26
34
  def get(query_url,
27
35
  headers: {})
28
- return HttpRequest.new(HttpMethodEnum::GET,
29
- query_url,
30
- headers: headers)
36
+ HttpRequest.new(HttpMethodEnum::GET,
37
+ query_url,
38
+ headers: headers)
39
+ end
40
+
41
+ # Get a HEAD HttpRequest object.
42
+ # @param [String] The URL to send the request to.
43
+ # @param [Hash, Optional] The headers for the HTTP Request.
44
+ def head(query_url,
45
+ headers: {})
46
+ HttpRequest.new(HttpMethodEnum::HEAD,
47
+ query_url,
48
+ headers: headers)
31
49
  end
32
-
50
+
33
51
  # Get a POST HttpRequest object.
34
52
  # @param [String] The URL to send the request to.
35
53
  # @param [Hash, Optional] The headers for the HTTP Request.
@@ -37,12 +55,12 @@ module Raas
37
55
  def post(query_url,
38
56
  headers: {},
39
57
  parameters: {})
40
- return HttpRequest.new(HttpMethodEnum::POST,
41
- query_url,
42
- headers: headers,
43
- parameters: parameters)
58
+ HttpRequest.new(HttpMethodEnum::POST,
59
+ query_url,
60
+ headers: headers,
61
+ parameters: parameters)
44
62
  end
45
-
63
+
46
64
  # Get a PUT HttpRequest object.
47
65
  # @param [String] The URL to send the request to.
48
66
  # @param [Hash, Optional] The headers for the HTTP Request.
@@ -50,12 +68,12 @@ module Raas
50
68
  def put(query_url,
51
69
  headers: {},
52
70
  parameters: {})
53
- return HttpRequest.new(HttpMethodEnum::PUT,
54
- query_url,
55
- headers: headers,
56
- parameters: parameters)
71
+ HttpRequest.new(HttpMethodEnum::PUT,
72
+ query_url,
73
+ headers: headers,
74
+ parameters: parameters)
57
75
  end
58
-
76
+
59
77
  # Get a PATCH HttpRequest object.
60
78
  # @param [String] The URL to send the request to.
61
79
  # @param [Hash, Optional] The headers for the HTTP Request.
@@ -63,22 +81,22 @@ module Raas
63
81
  def patch(query_url,
64
82
  headers: {},
65
83
  parameters: {})
66
- return HttpRequest.new(HttpMethodEnum::PATCH,
67
- query_url,
68
- headers: headers,
69
- parameters: parameters)
84
+ HttpRequest.new(HttpMethodEnum::PATCH,
85
+ query_url,
86
+ headers: headers,
87
+ parameters: parameters)
70
88
  end
71
-
89
+
72
90
  # Get a DELETE HttpRequest object.
73
91
  # @param [String] The URL to send the request to.
74
92
  # @param [Hash, Optional] The headers for the HTTP Request.
75
93
  def delete(query_url,
76
94
  headers: {},
77
95
  parameters: {})
78
- return HttpRequest.new(HttpMethodEnum::DELETE,
79
- query_url,
80
- headers: headers,
81
- parameters: parameters)
96
+ HttpRequest.new(HttpMethodEnum::DELETE,
97
+ query_url,
98
+ headers: headers,
99
+ parameters: parameters)
82
100
  end
83
101
  end
84
102
  end
@@ -1,12 +1,15 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module Raas
5
+ # Represents an Http call in context.
4
6
  class HttpContext
5
7
  attr_accessor :request, :response
6
8
 
7
9
  # The constructor.
8
10
  # @param [HttpRequest] An HttpRequest object representing the HTTP request.
9
- # @param [HttpResponse] An HttpResponse object representing the HTTP response.
11
+ # @param [HttpResponse] An HttpResponse object representing the HTTP
12
+ # response.
10
13
  def initialize(request, response)
11
14
  @request = request
12
15
  @response = response
@@ -1,7 +1,11 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module Raas
5
+ # HTTP Methods Enumeration.
4
6
  class HttpMethodEnum
5
- HTTPMETHODENUM = [GET = 'GET', POST = 'POST', PUT = 'PUT', PATCH = 'PATCH', DELETE = 'DELETE']
7
+ HTTPMETHODENUM = [GET = 'GET'.freeze, POST = 'POST'.freeze,
8
+ PUT = 'PUT'.freeze, PATCH = 'PATCH'.freeze,
9
+ DELETE = 'DELETE'.freeze, HEAD = 'HEAD'.freeze].freeze
6
10
  end
7
11
  end
@@ -1,8 +1,11 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module Raas
5
+ # Represents a single Http Request.
4
6
  class HttpRequest
5
- attr_accessor :http_method, :query_url, :headers, :parameters, :username, :password
7
+ attr_accessor :http_method, :query_url, :headers,
8
+ :parameters, :username, :password
6
9
 
7
10
  # The constructor.
8
11
  # @param [HttpMethodEnum] The HTTP method.
@@ -37,7 +40,8 @@ module Raas
37
40
  # @param [String] The name of the query parameter.
38
41
  # @param [String] The value of the query parameter.
39
42
  def add_query_parameter(name, value)
40
- @query_url = APIHelper.append_url_with_query_parameters(@query_url, name => value)
43
+ @query_url = APIHelper.append_url_with_query_parameters(@query_url,
44
+ name => value)
41
45
  @query_url = APIHelper.clean_url(@query_url)
42
46
  end
43
47
  end
@@ -1,6 +1,8 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module Raas
5
+ # Http response received.
4
6
  class HttpResponse
5
7
  attr_accessor :status_code, :headers, :raw_body
6
8
 
@@ -1,52 +1,58 @@
1
- # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  require 'date'
4
5
  module Raas
6
+ # Represents an Account
5
7
  class AccountModel < BaseModel
6
- # Account Identifier
8
+ # An account identifier
7
9
  # @return [String]
8
10
  attr_accessor :account_identifier
9
11
 
10
- # Display Name
12
+ # An account number
13
+ # @return [String]
14
+ attr_accessor :account_number
15
+
16
+ # A display name
11
17
  # @return [String]
12
18
  attr_accessor :display_name
13
19
 
14
- # Currency Code
20
+ # The currency code for the account
15
21
  # @return [String]
16
22
  attr_accessor :currency_code
17
23
 
18
- # Current Balance
24
+ # The current balance of the account
19
25
  # @return [Float]
20
26
  attr_accessor :current_balance
21
27
 
22
- # Date Created
28
+ # The date the account was created
23
29
  # @return [DateTime]
24
30
  attr_accessor :created_at
25
31
 
26
- # Status
32
+ # The status of the account
27
33
  # @return [String]
28
34
  attr_accessor :status
29
35
 
30
- # Contact Email
36
+ # The contact email on file for the account
31
37
  # @return [String]
32
38
  attr_accessor :contact_email
33
39
 
34
- # A mapping from model property names to API property names
40
+ # A mapping from model property names to API property names.
35
41
  def self.names
36
- if @_hash.nil?
37
- @_hash = {}
38
- @_hash["account_identifier"] = "accountIdentifier"
39
- @_hash["display_name"] = "displayName"
40
- @_hash["currency_code"] = "currencyCode"
41
- @_hash["current_balance"] = "currentBalance"
42
- @_hash["created_at"] = "createdAt"
43
- @_hash["status"] = "status"
44
- @_hash["contact_email"] = "contactEmail"
45
- end
42
+ @_hash = {} if @_hash.nil?
43
+ @_hash['account_identifier'] = 'accountIdentifier'
44
+ @_hash['account_number'] = 'accountNumber'
45
+ @_hash['display_name'] = 'displayName'
46
+ @_hash['currency_code'] = 'currencyCode'
47
+ @_hash['current_balance'] = 'currentBalance'
48
+ @_hash['created_at'] = 'createdAt'
49
+ @_hash['status'] = 'status'
50
+ @_hash['contact_email'] = 'contactEmail'
46
51
  @_hash
47
52
  end
48
53
 
49
54
  def initialize(account_identifier = nil,
55
+ account_number = nil,
50
56
  display_name = nil,
51
57
  currency_code = 'USD',
52
58
  current_balance = nil,
@@ -54,6 +60,7 @@ module Raas
54
60
  status = nil,
55
61
  contact_email = nil)
56
62
  @account_identifier = account_identifier
63
+ @account_number = account_number
57
64
  @display_name = display_name
58
65
  @currency_code = currency_code
59
66
  @current_balance = current_balance
@@ -62,21 +69,23 @@ module Raas
62
69
  @contact_email = contact_email
63
70
  end
64
71
 
65
- # Creates an instance of the object from a hash
72
+ # Creates an instance of the object from a hash.
66
73
  def self.from_hash(hash)
67
74
  return nil unless hash
68
75
 
69
- # Extract variables from the hash
76
+ # Extract variables from the hash.
70
77
  account_identifier = hash['accountIdentifier']
78
+ account_number = hash['accountNumber']
71
79
  display_name = hash['displayName']
72
80
  currency_code = hash['currencyCode'] ||= 'USD'
73
81
  current_balance = hash['currentBalance']
74
- created_at = DateTime.rfc3339(hash['createdAt']) if hash['createdAt']
82
+ created_at = APIHelper.rfc3339(hash['createdAt']) if hash['createdAt']
75
83
  status = hash['status']
76
84
  contact_email = hash['contactEmail']
77
85
 
78
- # Create object from extracted values
86
+ # Create object from extracted values.
79
87
  AccountModel.new(account_identifier,
88
+ account_number,
80
89
  display_name,
81
90
  currency_code,
82
91
  current_balance,