Class: Conekta::Resource
- Inherits:
-
ConektaObject
- Object
- Hash
- ConektaObject
- Conekta::Resource
- Defined in:
- lib/conekta/resource.rb
Direct Known Subclasses
Address, Card, Charge, Checkout, Customer, CustomerInfo, Destination, Details, DiscountLine, Event, LineItem, Log, Method, Order, Payee, PaymentMethod, PaymentSource, Payout, PayoutMethod, Plan, Refund, Return, ShippingContact, ShippingLine, Subscription, TaxLine, Token, Transfer, Webhook, WebhookLog
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Attributes inherited from ConektaObject
Class Method Summary collapse
Instance Method Summary collapse
- #_url ⇒ Object
- #create_member_with_relation(member, params, parent) ⇒ Object
-
#initialize(id = nil) ⇒ Resource
constructor
A new instance of Resource.
Methods inherited from ConektaObject
#class_name, class_name, #create_attr, #first, #inspect, #last, #load_from, #set_val, #to_s, #unset_key
Constructor Details
#initialize(id = nil) ⇒ Resource
Returns a new instance of Resource.
6 7 8 9 |
# File 'lib/conekta/resource.rb', line 6 def initialize(id=nil) @id = id super() end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/conekta/resource.rb', line 4 def id @id end |
Class Method Details
._url ⇒ Object
11 12 13 |
# File 'lib/conekta/resource.rb', line 11 def self._url() "/#{CGI.escape(underscored_class)}s" end |
.underscored_class ⇒ Object
21 22 23 |
# File 'lib/conekta/resource.rb', line 21 def self.underscored_class Conekta::Util.underscore(self.to_s) end |
Instance Method Details
#_url ⇒ Object
15 16 17 18 19 |
# File 'lib/conekta/resource.rb', line 15 def _url ensure_id return [self.class._url, id].join('/') end |
#create_member_with_relation(member, params, parent) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/conekta/resource.rb', line 25 def create_member_with_relation(member, params, parent) parent_klass = parent.class.underscored_class child = self.create_member(member, params) child.create_attr(parent_klass.to_s, parent) return child end |