Class: Badgrcat::ApiArray

Inherits:
Bearcat::ApiArray show all
Defined in:
lib/badgrcat/api_array.rb

Instance Attribute Summary

Attributes inherited from Bearcat::ApiArray

#members, #raw_response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Bearcat::ApiArray

#all_pages!, #all_pages_each, #each, #each_page, #initialize, #last, make_indifferent, #method, #page_count, #pages?, process_response

Constructor Details

This class inherits a constructor from Bearcat::ApiArray

Class Method Details

.array_key(response) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/badgrcat/api_array.rb', line 17

def self.array_key(response)
  if response.body.is_a?(Hash) && response.body.key?("result")
    "result"
  else
    nil
  end
end

Instance Method Details

#[](key) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/badgrcat/api_array.rb', line 5

def [](key)
  if key.is_a?(Numeric)
    super
  else
    @raw_response.body[key]
  end
end

#statusObject



13
14
15
# File 'lib/badgrcat/api_array.rb', line 13

def status
  self["status"]
end