Sha256: c951683a64b78a40f88b15dded9d46b45d7359308e2959014f9f06920bd617c1

Contents?: true

Size: 549 Bytes

Versions: 4

Compression:

Stored size: 549 Bytes

Contents

module A2z
  module Responses
    class Image
      attr_accessor :url, :width, :height
      
      def initialize
        @width = 0
        @height = 0
      end
      
      def width=(value)
        @width = value.to_i
      end
      
      def height=(value)
        @height = value.to_i
      end
      
      def self.from_response(data)
        new.tap do |image|
          image.url = data['URL']
          image.width = data['Width']
          image.height = data['Height']
          image.freeze
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
a2z-0.1.3 lib/a2z/responses/image.rb
a2z-0.1.2 lib/a2z/responses/image.rb
a2z-0.1.1 lib/a2z/responses/image.rb
a2z-0.1.0 lib/a2z/responses/image.rb