Class: Growatt::RequestPagination::DataPager

Inherits:
WrAPI::RequestPagination::DefaultPager
  • Object
show all
Defined in:
lib/growatt/pagination.rb

Class Method Summary collapse

Class Method Details

.data(body) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/growatt/pagination.rb', line 11

def self.data(body)
  # data is at 'back'
  if body.is_a? Hash
    if body['back']
      body['back']
    else
      body
    end
  else
    # in some cases wrong contenttype is returned instead of app/json
    JSON.parse(body)
  end
end