Class: Magentwo::Filter::Fields

Inherits:
Object
  • Object
show all
Defined in:
lib/filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ Fields

Returns a new instance of Fields.



139
140
141
# File 'lib/filter.rb', line 139

def initialize fields
  @fields = fields
end

Instance Attribute Details

#fieldsObject

Returns the value of attribute fields.



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

def fields
  @fields
end

Instance Method Details

#to_query(idx = nil) ⇒ Object



142
143
144
145
# File 'lib/filter.rb', line 142

def to_query idx=nil
  #TODO api supports nested field selection e.g. items[address[street]]
  "fields=items[#{CGI.escape(self.fields.map(&:to_s).join(","))}]"
end