Class: Nozbe::ContextInfoApiCall

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 retrieve the infos of a context

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, #url_encode

Constructor Details

#initialize(user_key, context) ⇒ ContextInfoApiCall

Returns a new instance of ContextInfoApiCall.



80
81
82
83
# File 'lib/nozbe/context.rb', line 80

def initialize(user_key, context)
  super(user_key, {:what => :context, :id => context.id})
  @context = context
end

Instance Method Details

#parse(json) ⇒ Object

Parse the JSON response, and return the context instance with its infos set



85
86
87
88
89
90
91
92
# File 'lib/nozbe/context.rb', line 85

def parse(json)
  raw_context = super(json)
  @context.name = raw_context["name"]
  @context.body = raw_context["body"]
  @context.body_show = raw_context["body_show"]
  @context.icon = raw_context["icon"]
  @context
end