Class: Ibanity::FlatResource

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/ibanity/api/flat_resource.rb

Direct Known Subclasses

Webhooks::Key

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ FlatResource

Returns a new instance of FlatResource.



16
17
18
# File 'lib/ibanity/api/flat_resource.rb', line 16

def initialize(raw)
  super(raw)
end

Class Method Details

.list_by_uri(uri:, key:) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/ibanity/api/flat_resource.rb', line 3

def self.list_by_uri(uri:, key:)
  raw_response = Ibanity.client.get(uri: uri)
  items = raw_response[key].map { |raw_item| new(raw_item) }
  Ibanity::Collection.new(
    klass:                  self,
    items:                  items,
    links:                  nil,
    paging:                 nil,
    synchronized_at:        nil,
    latest_synchronization: nil
  )
end