Sha256: 0df77715a74af9192600dd0886c1e7782f3f419addd153c2d92fe1ed1c07be1b

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

module Shutterstock
	class Licenses < Array
		attr_reader :raw_data, :total_count, :page, :per_page, :message, :errors
		def initialize(raw_data)
			@raw_data = raw_data

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

        @total_count   = raw_data["total_count"].to_i
        @page          = raw_data["page"].to_i
        @per_page          = raw_data["per_page"].to_i
        @message     = raw_data["message"]
        @errors     = raw_data["errors"]

			elsif raw_data.kind_of? Array
				super( @raw_data.map{ |license| License.new(license) } )
			end

			self
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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