Class: Oembedder::ConsumerRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/oembedder/consumer_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, params = {}) ⇒ ConsumerRequest

Returns a new instance of ConsumerRequest.



6
7
8
9
10
11
# File 'lib/oembedder/consumer_request.rb', line 6

def initialize(url, params = {})
  @url = url
  @maxwidth = params[:maxwidth]
  @maxheight = params[:maxheight]
  @format = params[:format] ||= :json # default is json
end

Instance Attribute Details

#formatObject

Returns the value of attribute format.



4
5
6
# File 'lib/oembedder/consumer_request.rb', line 4

def format
  @format
end

#maxheightObject

Returns the value of attribute maxheight.



4
5
6
# File 'lib/oembedder/consumer_request.rb', line 4

def maxheight
  @maxheight
end

#maxwidthObject

Returns the value of attribute maxwidth.



4
5
6
# File 'lib/oembedder/consumer_request.rb', line 4

def maxwidth
  @maxwidth
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/oembedder/consumer_request.rb', line 4

def url
  @url
end

Instance Method Details

#urlparamsObject



13
14
15
16
17
18
# File 'lib/oembedder/consumer_request.rb', line 13

def urlparams
  param = "?url=#{self.url}"
  param += "&maxwidth=#{self.maxwidth}" if self.maxwidth
  param += "&maxheight=#{self.maxheight}" if self.maxheight
  param
end