Class: Uphold::Entities::BaseEntity
- Inherits:
-
Object
- Object
- Uphold::Entities::BaseEntity
- Defined in:
- lib/uphold/entities/base_entity.rb
Direct Known Subclasses
Asset, AuthToken, Card, Contact, Error, LedgerEntry, OAuthError, Phone, Ticker, Transaction, User
Defined Under Namespace
Classes: PaginatedCollection
Class Method Summary collapse
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ BaseEntity
constructor
A new instance of BaseEntity.
Constructor Details
#initialize(attributes = {}) ⇒ BaseEntity
Returns a new instance of BaseEntity.
13 14 15 |
# File 'lib/uphold/entities/base_entity.rb', line 13 def initialize(attributes = {}) super(Uphold::Helpers.underscored_hash(attributes)) end |
Class Method Details
.from_collection(entities, content_range) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/uphold/entities/base_entity.rb', line 6 def self.from_collection(entities, content_range) total_size = (content_range && content_range.split('/')[1]) || entities.size items = entities.map { |entity| new(entity.to_h) } PaginatedCollection.new(items, total_size) end |