Class: Nozbe::ProjectNewApiCall

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

Overview

This class is used internaly by the Project class to make the API call that create a new project

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, project) ⇒ ProjectNewApiCall

Returns a new instance of ProjectNewApiCall.



103
104
105
106
107
108
# File 'lib/nozbe/project.rb', line 103

def initialize(user_key, project)
  super(user_key, {
      :name => url_encode(project.name), 
      :body => url_encode(project.body)})
  @project = project
end

Instance Method Details

#parse(json) ⇒ Object

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



110
111
112
113
114
# File 'lib/nozbe/project.rb', line 110

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