Class: Windy::Collection

Inherits:
Base
  • Object
show all
Includes:
Enumerable, Finders
Defined in:
lib/windy.rb

Direct Known Subclasses

Columns, Page, Rows

Instance Attribute Summary

Attributes inherited from Base

#connection

Instance Method Summary collapse

Methods included from Finders

#[], #method_missing, #respond_to?

Methods inherited from Base

#body, #initialize, #inspect, #json, #prepare_request, root

Constructor Details

This class inherits a constructor from Windy::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Windy::Finders

Instance Method Details

#create_record(attributes) ⇒ Object



126
127
128
# File 'lib/windy.rb', line 126

def create_record(attributes)
  record_class.new(attributes)
end

#each(&block) ⇒ Object



112
113
114
# File 'lib/windy.rb', line 112

def each(&block)
  records.each(&block)
end

#record_attributesObject



116
117
118
# File 'lib/windy.rb', line 116

def record_attributes
  json
end

#recordsObject



120
121
122
123
124
# File 'lib/windy.rb', line 120

def records
  @records ||= record_attributes.map do |attributes|
    create_record(attributes)
  end
end