Sha256: 937f11af20d78b8c29935b1d0d8e087bf6edc66a57f55797dfe0c38f7e09c458

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

module Shutterstock
	class Images < Array
		attr_reader :raw_data, :page, :total_count, :sort_method, :search_id
		def initialize(raw_data)
			@raw_data = raw_data

			if raw_data.kind_of? Hash
				super(@raw_data["data"].map{ |image| Image.new(image) })

				@total_count   = raw_data["total_count"].to_i
				@page          = raw_data["page"].to_i
				# @sort_method   = raw_data["sort_method"]
				@search_id     = raw_data["search_id"]
			elsif raw_data.kind_of? Array
				super( @raw_data.map{ |image| Image.new(image) } )
			end

			self
		end

    # Fill each image in array
    def fill
      self.each {|image| image.fill}
    end

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shutterstock-v2-0.0.1 lib/client/images.rb