Class: Nozbe::ContextsListApiCall

Inherits:
ApiCall
  • Object
show all
Defined in:
lib/nozbe/context.rb

Overview

This class is used internaly by the Context class to make the API call that list all contexts

Constant Summary

Constants inherited from ApiCall

ApiCall::API_BASE_URL

Instance Attribute Summary

Attributes inherited from ApiCall

#action, #parameters, #required_parameters

Instance Method Summary collapse

Methods inherited from ApiCall

action, #build_query_string, #build_request_path, #call, #do_request, #initialize, #url_encode

Constructor Details

This class inherits a constructor from Nozbe::ApiCall

Instance Method Details

#parse(json) ⇒ Object

Parse the JSON response, and return an Array of Context instances



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/nozbe/context.rb', line 63

def parse(json)
  contexts = super(json)
  contexts.collect do |raw_context|
    context = Context.new
    context.id = raw_context["id"]
    context.name = raw_context["name"]
    context.count = raw_context["count"]
    context.count = raw_context["icon"]
    context
  end
end