Class: Justifi::JustifiObject

Inherits:
Object
  • Object
show all
Extended by:
JustifiOperations
Defined in:
lib/justifi/justifi_object.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JustifiOperations

execute_get_request, execute_patch_request, execute_post_request, list

Methods included from APIOperations::ClassMethods

#execute_get_request, #execute_patch_request, #execute_post_request, #http_connection, #idempotently_request

Constructor Details

#initialize(id: nil, headers: {}, raw_response: nil) ⇒ JustifiObject

Returns a new instance of JustifiObject.



9
10
11
12
13
# File 'lib/justifi/justifi_object.rb', line 9

def initialize(id: nil, headers: {}, raw_response: nil)
  @id = id
  @headers = Util.normalize_headers(headers)
  @raw_response = raw_response
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



7
8
9
# File 'lib/justifi/justifi_object.rb', line 7

def headers
  @headers
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/justifi/justifi_object.rb', line 7

def id
  @id
end

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



7
8
9
# File 'lib/justifi/justifi_object.rb', line 7

def raw_response
  @raw_response
end

Class Method Details

.construct_from(path, response, headers = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/justifi/justifi_object.rb', line 15

def self.construct_from(path, response, headers = {})
  values = response.is_a?(JustifiResponse) ? response.data : response

  new(id: values[:id], raw_response: response)
    .send(:initialize_from, values, headers)
end