Class: Vindi::Resource
- Inherits:
-
Object
- Object
- Vindi::Resource
- Defined in:
- lib/vindi/resource.rb
Direct Known Subclasses
Affiliate, Bill, BillItem, Charge, Customer, Discount, ExportBatch, ImportBatch, Invoice, Issue, Merchant, MerchantUser, Message, Movement, Notification, Partner, PaymentMethod, PaymentProfile, Period, Plan, Product, ProductItem, Public, Role, Subscription, Transaction, Usage, User
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Resource
constructor
A new instance of Resource.
- #inspect ⇒ Object
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(attributes = {}) ⇒ Resource
Returns a new instance of Resource.
7 8 9 |
# File 'lib/vindi/resource.rb', line 7 def initialize(attributes = {}) @attributes = attributes || {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/vindi/resource.rb', line 15 def method_missing(method_name, *args, &block) if attributes.key?(method_name) attributes[method_name] else super end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/vindi/resource.rb', line 5 def attributes @attributes end |
Class Method Details
.endpoint ⇒ Object
27 28 29 |
# File 'lib/vindi/resource.rb', line 27 def self.endpoint raise NotImplementedError, "Subclasses must implement .endpoint" end |
Instance Method Details
#inspect ⇒ Object
11 12 13 |
# File 'lib/vindi/resource.rb', line 11 def inspect "#<#{self.class} #{attributes.inspect}>" end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
23 24 25 |
# File 'lib/vindi/resource.rb', line 23 def respond_to_missing?(method_name, include_private = false) attributes.key?(method_name) || super end |