Method: LinkshareAPI::Response#initialize
- Defined in:
- lib/linkshare_api/response.rb
#initialize(response, from) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 14 15 |
# File 'lib/linkshare_api/response.rb', line 7 def initialize(response, from) @request = response.request result = response[LinkshareAPI::RESULT[from]] @from = from @total_matches = result["TotalMatches"].to_i @total_pages = result["TotalPages"].to_i @page_number = result[LinkshareAPI::PAGE_NUMBER[from]].to_i @data = parse(result[LinkshareAPI::PARSE_RESULT[from]]) end |