Class: Bitly::Response
- Inherits:
-
Object
- Object
- Bitly::Response
- Defined in:
- lib/providers/bitly/response.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
Instance Method Summary collapse
-
#initialize(response, format = :json) ⇒ Response
constructor
A new instance of Response.
- #parse ⇒ Object
- #parser ⇒ Object
Constructor Details
#initialize(response, format = :json) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 14 |
# File 'lib/providers/bitly/response.rb', line 9 def initialize(response, format=:json) @response = response @format = format @parser = parser parse end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/providers/bitly/response.rb', line 5 def format @format end |
Instance Method Details
#parse ⇒ Object
7 |
# File 'lib/providers/bitly/response.rb', line 7 def parse; end |
#parser ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/providers/bitly/response.rb', line 17 def parser case format when :json return JSON when :xml return Nokogiri::XML else raise UnsupportedFormat, format end end |