Class: Fotolia::Medium::License

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

Overview

Represents a license in which Fotolia’s media are available.

See www.fotolia.com/Info/SizesAndUses for an overview of available licenses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(medium, attributes) ⇒ License

Returns a new instance of License.



30
31
32
33
34
# File 'lib/fotolia/medium.rb', line 30

def initialize(medium, attributes)
  @medium = medium
  @name = attributes['name']
  @price = attributes['price']
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



28
29
30
# File 'lib/fotolia/medium.rb', line 28

def name
  @name
end

#priceObject (readonly)

Returns the value of attribute price.



28
29
30
# File 'lib/fotolia/medium.rb', line 28

def price
  @price
end

Instance Method Details

#dpiObject



52
53
54
55
56
57
58
# File 'lib/fotolia/medium.rb', line 52

def dpi
  begin
    @dpi ||= @medium.details['licenses_details'][self.name]['dpi']
  rescue
    nil
  end
end

#heightObject



44
45
46
47
48
49
50
# File 'lib/fotolia/medium.rb', line 44

def height
  begin
    @height ||= @medium.details['licenses_details'][self.name]['height']
  rescue
    nil
  end
end

#phraseObject



68
69
70
71
72
73
74
# File 'lib/fotolia/medium.rb', line 68

def phrase
  begin
    @phrase ||= @medium.details['licenses_details'][self.name]['phrase']
  rescue
    nil
  end
end

#ratioObject



60
61
62
63
64
65
66
# File 'lib/fotolia/medium.rb', line 60

def ratio
  begin
    @ratio ||= @medium.details['licenses_details'][self.name]['ratio']
  rescue
    nil
  end
end

#widthObject



36
37
38
39
40
41
42
# File 'lib/fotolia/medium.rb', line 36

def width
  begin
    @width ||= @medium.details['licenses_details'][self.name]['width']
  rescue
    nil
  end
end