Class: NovaposhtaApi::Model

Inherits:
Hashie::Trash
  • Object
show all
Includes:
Hashie::Extensions::Coercion, Hashie::Extensions::IgnoreUndeclared, Hashie::Extensions::IndifferentAccess
Defined in:
lib/novaposhta_api/model.rb

Class Method Summary collapse

Class Method Details

.extract_collection(data) ⇒ Object



10
11
12
# File 'lib/novaposhta_api/model.rb', line 10

def extract_collection(data)
  NovaposhtaApi::Collection.new(data, self)
end

.extract_single(data) ⇒ Object



14
15
16
17
18
# File 'lib/novaposhta_api/model.rb', line 14

def extract_single(data)
  item = data.is_a?(Array) ? data.first : data

  new(item)
end