Class: Scribesend::ListObject

Inherits:
ScribesendObject show all
Defined in:
lib/scribesend/list_object.rb

Instance Method Summary collapse

Methods inherited from ScribesendObject

#[]=, #as_json, construct_from, #initialize, #inspect, #keys, #refresh_from, #serialize_nested_object, serialize_params, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from Scribesend::ScribesendObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Scribesend::ScribesendObject

Instance Method Details

#[](k) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/scribesend/list_object.rb', line 3

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

#each(&blk) ⇒ Object



12
13
14
# File 'lib/scribesend/list_object.rb', line 12

def each(&blk)
  self.data.each(&blk)
end