Class: PayPro::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/pay_pro/entities/entity.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client:, attributes: {}) ⇒ Entity

Returns a new instance of Entity.



14
15
16
17
18
19
# File 'lib/pay_pro/entities/entity.rb', line 14

def initialize(api_client:, attributes: {})
  @api_client = api_client
  @attributes = attributes

  generate_accessors(attributes)
end

Instance Attribute Details

#api_clientObject (readonly)

Returns the value of attribute api_client.



5
6
7
# File 'lib/pay_pro/entities/entity.rb', line 5

def api_client
  @api_client
end

Class Method Details

.create_from_data(data, api_client:) ⇒ Object



7
8
9
10
# File 'lib/pay_pro/entities/entity.rb', line 7

def self.create_from_data(data, api_client:)
  attributes = Util.normalize_api_attributes(data)
  new(attributes: attributes, api_client: api_client)
end

Instance Method Details

#inspectObject



21
22
23
# File 'lib/pay_pro/entities/entity.rb', line 21

def inspect
  "#<#{self.class}> #{JSON.pretty_generate(@attributes)}"
end