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



138
139
140
# File 'lib/windy.rb', line 138

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

#each(&block) ⇒ Object



124
125
126
# File 'lib/windy.rb', line 124

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

#record_attributesObject



128
129
130
# File 'lib/windy.rb', line 128

def record_attributes
  json
end

#recordsObject



132
133
134
135
136
# File 'lib/windy.rb', line 132

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