Class: Maestrano::API::ListObject
- Inherits:
-
Object
- Object
- Object
- Maestrano::API::ListObject
show all
- Defined in:
- lib/maestrano/api/list_object.rb
Instance Attribute Summary
Attributes inherited from Object
#api_token
Instance Method Summary
collapse
Methods inherited from Object
#[]=, #_dump, _load, #as_json, construct_from, #initialize, #inspect, #keys, #refresh_from, #respond_to?, #to_hash, #to_json, #to_s, #values
Methods included from Preset
included
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Maestrano::API::Object
Instance Method Details
5
6
7
8
9
10
11
12
|
# File 'lib/maestrano/api/list_object.rb', line 5
def [](k)
case k
when String, Symbol
super
else
raise ArgumentError.new("You tried to access the #{k.inspect} index, but ListObject types only support String keys. (HINT: List calls return an object with a 'data' (which is the data array). You likely want to call #data[#{k.inspect}])")
end
end
|
#all(params = {}, api_token = nil) ⇒ Object
#create(params = {}, api_token = nil) ⇒ Object
#each(&blk) ⇒ Object
14
15
16
|
# File 'lib/maestrano/api/list_object.rb', line 14
def each(&blk)
self.data.each(&blk)
end
|
#retrieve(id, api_token = nil) ⇒ Object