Class: PayPro::Entity
- Inherits:
-
Object
- Object
- PayPro::Entity
- Defined in:
- lib/pay_pro/entities/entity.rb
Direct Known Subclasses
Chargeback, Event, InstallmentPlanPeriod, List, Mandate, PayMethod, Resource, SubscriptionPeriod
Instance Attribute Summary collapse
-
#api_client ⇒ Object
readonly
Returns the value of attribute api_client.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_client:, attributes: {}) ⇒ Entity
constructor
A new instance of Entity.
- #inspect ⇒ Object
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_client ⇒ Object (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
#inspect ⇒ Object
21 22 23 |
# File 'lib/pay_pro/entities/entity.rb', line 21 def inspect "#<#{self.class}> #{JSON.pretty_generate(@attributes)}" end |