Class: Nozbe::ProjectInfoApiCall

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 retrieve the infos of a 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) ⇒ ProjectInfoApiCall

Returns a new instance of ProjectInfoApiCall.



85
86
87
88
# File 'lib/nozbe/project.rb', line 85

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

Instance Method Details

#parse(json) ⇒ Object

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



90
91
92
93
94
95
96
# File 'lib/nozbe/project.rb', line 90

def parse(json)
  raw_project = super(json)
  @project.name = raw_project["name"]
  @project.body = raw_project["body"]
  @project.body_show = raw_project["body_show"]
  @project
end