Sha256: 65a84d052d8cbfe803f697df0be7ea739075771500338a2f4253ebcbc41bfb5e

Contents?: true

Size: 685 Bytes

Versions: 10

Compression:

Stored size: 685 Bytes

Contents

module Lipseys
  class Image < Base

    API_URL = 'https://www.lipseys.com/API/catalog.ashx'

    def initialize(options = {})
      requires!(options, :username, :password)

      @options = options
    end

    def self.urls(options = {})
      new(options).urls
    end

    def urls(options = {})
      tempfile  = stream_to_tempfile(API_URL, @options)
      images    = Array.new

      Lipseys::Parser.parse(tempfile, 'Item') do |item|
        image = Hash.new
        image[:item_identifier] = content_for(item, 'ItemNo')
        image[:url] = "http://www.lipseys.net/images/#{content_for(item, 'Image')}"

        images.push(image)
      end

      images
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lipseys-5.0.0 lib/lipseys/image.rb
lipseys-4.0.0 lib/lipseys/image.rb
lipseys-3.0.1 lib/lipseys/image.rb
lipseys-3.0.0 lib/lipseys/image.rb
lipseys-2.1.0 lib/lipseys/image.rb
lipseys-2.0.9 lib/lipseys/image.rb
lipseys-2.0.8 lib/lipseys/image.rb
lipseys-2.0.7 lib/lipseys/image.rb
lipseys-2.0.6 lib/lipseys/image.rb
lipseys-2.0.5 lib/lipseys/image.rb