Class: NHApi::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/nh_api/image.rb

Direct Known Subclasses

Cover, Page, Thumbnail

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Image

Returns a new instance of Image.



7
8
9
10
11
12
# File 'lib/nh_api/image.rb', line 7

def initialize(attributes)
  @filetype = NHApi::FILETYPES[attributes["t"]]
  @width = attributes["w"]
  @height = attributes["h"]
  @url = generate_url(attributes)
end

Instance Attribute Details

#filetypeObject (readonly)

Returns the value of attribute filetype.



5
6
7
# File 'lib/nh_api/image.rb', line 5

def filetype
  @filetype
end

#heightObject (readonly)

Returns the value of attribute height.



5
6
7
# File 'lib/nh_api/image.rb', line 5

def height
  @height
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/nh_api/image.rb', line 5

def url
  @url
end

#widthObject (readonly)

Returns the value of attribute width.



5
6
7
# File 'lib/nh_api/image.rb', line 5

def width
  @width
end