Class: Nozbe::NoteNewApiCall

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

Overview

This class is used internaly by the Note class to make the API call that create a new note

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, note) ⇒ NoteNewApiCall

Returns a new instance of NoteNewApiCall.



68
69
70
71
72
73
74
75
# File 'lib/nozbe/note.rb', line 68

def initialize(user_key, note)
  super(user_key, {
      :name => url_encode(note.name), 
      :body => url_encode(note.body), 
      :project_id => note.project.id, 
      :context_id => note.context.id,})
  @note = note
end

Instance Method Details

#parse(json) ⇒ Object

Parse the JSON response, and return the note instance with its ID set



77
78
79
80
81
# File 'lib/nozbe/note.rb', line 77

def parse(json)
  res = super(json)
  @note.id = res["response"]
  @note
end