zohoProjects 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +116 -82
- data/lib/projects/model/Project.rb +30 -3
- data/lib/projects/util/ZohoHTTPClient.rb +2 -2
- data/lib/zohoProjects/version.rb +1 -1
- data/zohoProjects.gemspec +2 -2
- metadata +8 -8
    
        data/README.md
    CHANGED
    
    | @@ -1,141 +1,175 @@ | |
| 1 | 
            -
            # ZohoProjects
         | 
| 1 | 
            +
            # ZohoProjects Ruby Client Library
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
             | 
| 4 | 
            +
            The Ruby library for integrating with the Zoho Projects API. Use this object-based Ruby wrapper to easily integrate Zoho Projects modules like portals, projects, milestones, tasklists, events etc. into your application.
         | 
| 4 5 |  | 
| 5 6 | 
             
            ## Installation
         | 
| 6 7 |  | 
| 7 | 
            -
            Add this line to your application's Gemfile:
         | 
| 8 8 |  | 
| 9 | 
            -
             | 
| 9 | 
            +
            There are a couple of ways of installing ZohoProjects:
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            Install 1:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            Start by adding this line to your application's Gemfile: 
         | 
| 10 14 |  | 
| 11 | 
            -
             | 
| 15 | 
            +
                  gem 'zohoProjects'
         | 
| 12 16 |  | 
| 13 | 
            -
             | 
| 17 | 
            +
            And follow it with executing this command:
         | 
| 18 | 
            +
             
         | 
| 19 | 
            +
                  $ bundle
         | 
| 14 20 |  | 
| 15 | 
            -
             | 
| 21 | 
            +
            Install 2:
         | 
| 16 22 |  | 
| 17 | 
            -
             | 
| 23 | 
            +
            To fully install the Projects wrapper yourself, just execute this command:
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  $ gem install zohoProjects
         | 
| 18 26 |  | 
| 19 27 | 
             
            ## Documentation
         | 
| 20 28 |  | 
| 21 | 
            -
             | 
| 29 | 
            +
             | 
| 30 | 
            +
            [API Reference](https://www.zoho.com/projects/help/rest-api/zohoprojectsapi.html)
         | 
| 22 31 |  | 
| 23 32 | 
             
            ## Usage
         | 
| 24 33 |  | 
| 25 | 
            -
            If you want to use all our zoho projects services API you should have a valid Zoho username, password and a valid authtoken.
         | 
| 26 34 |  | 
| 27 | 
            -
             | 
| 35 | 
            +
            In order to access the Zoho Projects APIs, users need to have a valid Zoho account and a valid Auth Token.
         | 
| 28 36 |  | 
| 29 | 
            -
             | 
| 37 | 
            +
            ### Sign up for a Zoho Account:
         | 
| 30 38 |  | 
| 31 | 
            -
             | 
| 39 | 
            +
            - - -
         | 
| 32 40 |  | 
| 33 | 
            -
             | 
| 41 | 
            +
            For setting up a Zoho account, access the Zoho Projects [Sign Up](https://www.zoho.com/projects/zp-signup.html) page and enter the requisite details - email address and password.
         | 
| 34 42 |  | 
| 35 | 
            -
             | 
| 43 | 
            +
            ### Generate Auth Token:
         | 
| 36 44 |  | 
| 37 | 
            -
             | 
| 45 | 
            +
            - - -
         | 
| 46 | 
            +
             
         | 
| 47 | 
            +
            To generate the Auth Token, you need to send an authentication request to Zoho Accounts in a prescribed URL format. [Refer here](https://www.zoho.com/projects/help/rest-api/get-tickets-api.html)
         | 
| 38 48 |  | 
| 39 | 
            -
            You have two ways to create an instance for PortalsAPI. Here is the example code,
         | 
| 40 49 |  | 
| 41 | 
            -
             | 
| 50 | 
            +
            ## Ruby Wrappers - Sample
         | 
| 42 51 |  | 
| 43 | 
            -
             | 
| 44 | 
            -
            			
         | 
| 45 | 
            -
            2) Pass your authToken and portalId to create an instance for ZohoProjects and then get the instance for PortalsAPI:
         | 
| 52 | 
            +
            ### How to access the Zoho Projects APIs through Ruby wrapper classes?
         | 
| 46 53 |  | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 54 | 
            +
            - - -
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            To access the Projects APIs, add this gem file in your application:
         | 
| 57 | 
            +
            	
         | 
| 58 | 
            +
            	require "zohoProjects"
         | 
| 51 59 |  | 
| 52 | 
            -
             | 
| 53 | 
            -
            			
         | 
| 54 | 
            -
            			queryMap["status"] = "open"
         | 
| 55 | 
            -
            			
         | 
| 56 | 
            -
            			begin
         | 
| 57 | 
            -
            			
         | 
| 58 | 
            -
            ## Get the list of portals:
         | 
| 60 | 
            +
            ### Create PortalsAPI instance:
         | 
| 59 61 |  | 
| 60 62 | 
             
            - - -
         | 
| 61 | 
            -
            			
         | 
| 62 | 
            -
            If you want to get all your portals, you need to call the 'getPortals' method. It returns the List of Portal object.
         | 
| 63 63 |  | 
| 64 | 
            -
             | 
| 65 | 
            -
            			
         | 
| 66 | 
            -
            If you want to parse the portal id from the List of Portal object then you need to write your code as mentioned below:
         | 
| 64 | 
            +
            Now there are two ways of creating an instance of PortalsAPI.
         | 
| 67 65 |  | 
| 68 | 
            -
             | 
| 69 | 
            -
            			
         | 
| 70 | 
            -
            ## Get the list of projects:
         | 
| 66 | 
            +
            Pass the AuthToken and create a PortalsAPI instance. 
         | 
| 71 67 |  | 
| 72 | 
            -
             | 
| 68 | 
            +
            Sample code:
         | 
| 73 69 |  | 
| 74 | 
            -
             | 
| 70 | 
            +
                    portalsAPI = PortalsAPI.new("{auth_token}")
         | 
| 75 71 |  | 
| 76 | 
            -
             | 
| 77 | 
            -
            			
         | 
| 78 | 
            -
            If you want to parse the project id from the List of Project object then you need to write your code as mentioned below:
         | 
| 72 | 
            +
            Pass the AuthToken and PortalId to first create an instance of ZohoProjects, and then proceed to get the instance of PortalsAPI. 
         | 
| 79 73 |  | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 74 | 
            +
            Sample code:
         | 
| 75 | 
            +
                   	
         | 
| 76 | 
            +
                   	zohoProject = ZohoProject.new("{auth_token}", "{portal_id}")
         | 
| 77 | 
            +
             
         | 
| 78 | 
            +
                    portalsAPI = zohoProject.getPortalsAPI
         | 
| 79 | 
            +
             
         | 
| 80 | 
            +
             
         | 
| 81 | 
            +
                    queryMap = Hash.new
         | 
| 82 | 
            +
             
         | 
| 83 | 
            +
                    queryMap["status"] = "open"
         | 
| 84 | 
            +
             
         | 
| 85 | 
            +
                    begin
         | 
| 86 | 
            +
             
         | 
| 87 | 
            +
             
         | 
| 88 | 
            +
            ### List all Portals:
         | 
| 83 89 |  | 
| 84 90 | 
             
            - - -
         | 
| 85 91 |  | 
| 86 | 
            -
            If you  | 
| 92 | 
            +
            If you wish to get the list of all your Zoho Projects portals, you need to call the `getPortals()` method by passing query string parameters in the format below:
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                        portals = portalsAPI.getPortals
         | 
| 95 | 
            +
             
         | 
| 96 | 
            +
            It returns the List of Portal object as a response.
         | 
| 87 97 |  | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 98 | 
            +
            Similarly, if you wish to parse the portal id from the List of Portal objects, you need to send a request in the prescribed format below:
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                        portalId = portals.get[0].getId
         | 
| 101 | 
            +
             
         | 
| 102 | 
            +
            ### List all Projects:
         | 
| 91 103 |  | 
| 92 104 | 
             
            - - -
         | 
| 93 105 |  | 
| 94 | 
            -
            If you  | 
| 106 | 
            +
            If you wish to get the list of all projects from the portal, you need to call the `getProjects()` method by passing query string parameters in the format below:
         | 
| 95 107 |  | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 108 | 
            +
                        projects = projectsAPI.getProjects(queryMap)
         | 
| 109 | 
            +
             
         | 
| 110 | 
            +
            It returns the List of Project object as a response.
         | 
| 111 | 
            +
             
         | 
| 112 | 
            +
            Similarly, if you wish to parse the project id from the List of Portal objects, you need to send a request in the format below:
         | 
| 100 113 |  | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 114 | 
            +
                        projectId = String.valueOf(projects[0].getId)
         | 
| 115 | 
            +
             
         | 
| 116 | 
            +
            ### Get Project details:
         | 
| 104 117 |  | 
| 105 118 | 
             
            - - - 
         | 
| 119 | 
            +
             
         | 
| 120 | 
            +
            In order to get the details of a project, you need to call the `get()` method by passing a projectId.
         | 
| 121 | 
            +
             
         | 
| 122 | 
            +
                        get = projectsAPI.get(projectId)
         | 
| 123 | 
            +
             
         | 
| 124 | 
            +
            ### Create a new Project:
         | 
| 106 125 |  | 
| 107 | 
            -
             | 
| 126 | 
            +
            - - - 
         | 
| 127 | 
            +
             
         | 
| 128 | 
            +
            To create a new project for the specific portal, you need to call the `create()` method by passing the Project object.
         | 
| 108 129 |  | 
| 109 | 
            -
             | 
| 130 | 
            +
                        project = Project.new
         | 
| 131 | 
            +
             
         | 
| 132 | 
            +
                        project.setName("Test")
         | 
| 133 | 
            +
                        project.setDescription("Test project")
         | 
| 134 | 
            +
             
         | 
| 135 | 
            +
                        create = projectsAPI.create(project)
         | 
| 110 136 |  | 
| 111 | 
            -
             | 
| 112 | 
            -
            			
         | 
| 113 | 
            -
            				get.setName("API")
         | 
| 137 | 
            +
            ### Update Project details:
         | 
| 114 138 |  | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 139 | 
            +
            - - - 
         | 
| 140 | 
            +
             
         | 
| 141 | 
            +
            To update the project details of a particular portal, you need to first fetch the project info. This can be achieved by calling the `get()` method. You can then proceed to update the name of the project (for example) with the help of a sample code below:
         | 
| 142 | 
            +
             | 
| 143 | 
            +
                        get = projectsAPI.get(projectId)
         | 
| 144 | 
            +
             
         | 
| 145 | 
            +
                        get.setName("API")
         | 
| 146 | 
            +
             
         | 
| 147 | 
            +
                        update = projectsAPI.update(get)
         | 
| 148 | 
            +
             | 
| 149 | 
            +
            ### Delete a Project:
         | 
| 119 150 |  | 
| 120 151 | 
             
            - - - 
         | 
| 152 | 
            +
             
         | 
| 153 | 
            +
            To delete an existing project of a particular portal, you need to call the `delete()` method and pass the projectid.
         | 
| 121 154 |  | 
| 122 | 
            -
             | 
| 155 | 
            +
                        delete = projectsAPI.delete(projectId)
         | 
| 156 | 
            +
             
         | 
| 157 | 
            +
                   
         | 
| 123 158 |  | 
| 124 | 
            -
             | 
| 125 | 
            -
            		
         | 
| 126 | 
            -
            			
         | 
| 127 | 
            -
            ## Catch the exception:
         | 
| 159 | 
            +
            ### Catch Exceptions:
         | 
| 128 160 |  | 
| 129 161 | 
             
            - - -
         | 
| 130 162 |  | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 163 | 
            +
            If there is any error encountered while calling the Ruby Wrappers of Zoho Projects API, the respective class will throw the ProjectsException. Use the below mentioned code to catch the ProjectsException:
         | 
| 164 | 
            +
             | 
| 165 | 
            +
                           rescue ProjectsException => pe
         | 
| 166 | 
            +
                            puts "Code: " + String(pe.getCode)
         | 
| 167 | 
            +
                            puts "Message: " + pe.getMessage
         | 
| 168 | 
            +
                       end
         | 
| 169 | 
            +
             
         | 
| 170 | 
            +
             
         | 
| 171 | 
            +
            For a full set of examples, click [here](../../tree/master/test).
         | 
| 172 | 
            +
             | 
| 139 173 | 
             
            ## Contributing
         | 
| 140 174 |  | 
| 141 175 | 
             
            1. Fork it
         | 
| @@ -5,8 +5,8 @@ module Projects | |
| 5 5 |  | 
| 6 6 | 
             
            		class Project
         | 
| 7 7 | 
             
            			private
         | 
| 8 | 
            -
            			attr_accessor :id, :name, :status, :createdDate, :createdDateFormat, :createdDateLong, :description, :ownerName, :ownerId, :openTaskCount, :closedTaskCount, :openMilestoneCount, :closedMilestoneCount, :openBugCount, :closedBugCount, :URL, :activityURL, :milestoneURL, :tasklistURL, :taskURL, :bugURL, :timesheetURL, :statusURL, :eventURL, :documentURL, :folderURL, :forumURL, :userURL | 
| 9 | 
            -
             | 
| 8 | 
            +
            			attr_accessor :id, :name, :templateId, :status, :createdDate, :createdDateFormat, :createdDateLong, :description, :ownerName, :ownerId, :openTaskCount, :closedTaskCount, :openMilestoneCount, :closedMilestoneCount, :openBugCount, :closedBugCount, :URL, :activityURL, :milestoneURL, :tasklistURL, :taskURL, :bugURL, :timesheetURL, :statusURL, :eventURL, :documentURL, :folderURL, :forumURL, :userURL;
         | 
| 9 | 
            +
            			
         | 
| 10 10 | 
             
            			public
         | 
| 11 11 |  | 
| 12 12 | 
             
            				# * Set the project id.
         | 
| @@ -48,6 +48,30 @@ module Projects | |
| 48 48 | 
             
            				def getName
         | 
| 49 49 | 
             
            					return @name
         | 
| 50 50 | 
             
            				end
         | 
| 51 | 
            +
            				
         | 
| 52 | 
            +
            				# * Set the template id of the project.
         | 
| 53 | 
            +
            				#
         | 
| 54 | 
            +
            				# ==== Parameters
         | 
| 55 | 
            +
            				#
         | 
| 56 | 
            +
            				# * templateId:: - ID of the template.
         | 
| 57 | 
            +
            				
         | 
| 58 | 
            +
            				def setTemplateId(templateId)
         | 
| 59 | 
            +
            				
         | 
| 60 | 
            +
            					@templateId = templateId
         | 
| 61 | 
            +
            				
         | 
| 62 | 
            +
            				end
         | 
| 63 | 
            +
            				
         | 
| 64 | 
            +
            				# * Get the template id of the project.
         | 
| 65 | 
            +
            				#
         | 
| 66 | 
            +
            				# ==== Returns
         | 
| 67 | 
            +
            				#
         | 
| 68 | 
            +
            				# * Returns the template id.
         | 
| 69 | 
            +
            				
         | 
| 70 | 
            +
            				def getTemplateId
         | 
| 71 | 
            +
            				
         | 
| 72 | 
            +
            					return @templateId
         | 
| 73 | 
            +
            					
         | 
| 74 | 
            +
            				end
         | 
| 51 75 |  | 
| 52 76 | 
             
            				# * Set the status of the project.
         | 
| 53 77 | 
             
            				# 
         | 
| @@ -586,8 +610,11 @@ module Projects | |
| 586 610 | 
             
            					if status != nil
         | 
| 587 611 | 
             
            						requestBody["status"] = status
         | 
| 588 612 | 
             
            					end
         | 
| 613 | 
            +
            					if templateId != nil
         | 
| 614 | 
            +
            						requestBody["template_id"] = templateId
         | 
| 615 | 
            +
            					end
         | 
| 589 616 | 
             
            					return requestBody
         | 
| 590 617 | 
             
            				end
         | 
| 591 618 | 
             
            		end
         | 
| 592 619 | 
             
            	end
         | 
| 593 | 
            -
            end
         | 
| 620 | 
            +
            end
         | 
| @@ -77,7 +77,7 @@ module Projects | |
| 77 77 | 
             
            				header["Accept"] = "application/json"
         | 
| 78 78 | 
             
            				header["Content-Type"] = "application/x-www-form-urlencoded"
         | 
| 79 79 | 
             
            				header["Accept-Charset"] = "UTF-8"
         | 
| 80 | 
            -
            				header["User-Agent"] = "ZohoProjects-Ruby-Wrappers/0.0. | 
| 80 | 
            +
            				header["User-Agent"] = "ZohoProjects-Ruby-Wrappers/0.0.6"
         | 
| 81 81 | 
             
            				return header
         | 
| 82 82 | 
             
            			end
         | 
| 83 83 |  | 
| @@ -202,4 +202,4 @@ module Projects | |
| 202 202 | 
             
            			end
         | 
| 203 203 | 
             
            		end
         | 
| 204 204 | 
             
            	end
         | 
| 205 | 
            -
            end
         | 
| 205 | 
            +
            end
         | 
    
        data/lib/zohoProjects/version.rb
    CHANGED
    
    
    
        data/zohoProjects.gemspec
    CHANGED
    
    | @@ -7,9 +7,9 @@ Gem::Specification.new do |spec| | |
| 7 7 | 
             
              spec.name          = "zohoProjects"
         | 
| 8 8 | 
             
              spec.version       = ZohoProjects::VERSION
         | 
| 9 9 | 
             
              spec.authors       = ["Zoho Corp."]
         | 
| 10 | 
            -
              spec.email         = [" | 
| 10 | 
            +
              spec.email         = ["sahaya.ramesh@zohocorp.com"]
         | 
| 11 11 | 
             
              spec.summary       = %q{Wrapper for Zoho Projects.}
         | 
| 12 | 
            -
              spec.description   = %q{Zoho Projects API lets, users/developers extend their web applications to push or pull data into or from Zoho Projects for application mashups. - See more at:  | 
| 12 | 
            +
              spec.description   = %q{Zoho Projects API lets, users/developers extend their web applications to push or pull data into or from Zoho Projects for application mashups. - See more at: https://www.zoho.com/projects/help/rest-api/zohoprojectsapi.html}
         | 
| 13 13 | 
             
              spec.homepage      = ""
         | 
| 14 14 | 
             
              spec.license       = "MIT"
         | 
| 15 15 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: zohoProjects
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.6
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,11 +9,11 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2014-10- | 
| 12 | 
            +
            date: 2014-10-29 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: bundler
         | 
| 16 | 
            -
              requirement: & | 
| 16 | 
            +
              requirement: &20700380 !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ~>
         | 
| @@ -21,10 +21,10 @@ dependencies: | |
| 21 21 | 
             
                    version: '1.6'
         | 
| 22 22 | 
             
              type: :development
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: * | 
| 24 | 
            +
              version_requirements: *20700380
         | 
| 25 25 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 26 26 | 
             
              name: rake
         | 
| 27 | 
            -
              requirement: & | 
| 27 | 
            +
              requirement: &20699040 !ruby/object:Gem::Requirement
         | 
| 28 28 | 
             
                none: false
         | 
| 29 29 | 
             
                requirements:
         | 
| 30 30 | 
             
                - - ! '>='
         | 
| @@ -32,12 +32,12 @@ dependencies: | |
| 32 32 | 
             
                    version: '0'
         | 
| 33 33 | 
             
              type: :development
         | 
| 34 34 | 
             
              prerelease: false
         | 
| 35 | 
            -
              version_requirements: * | 
| 35 | 
            +
              version_requirements: *20699040
         | 
| 36 36 | 
             
            description: ! 'Zoho Projects API lets, users/developers extend their web applications
         | 
| 37 37 | 
             
              to push or pull data into or from Zoho Projects for application mashups. - See more
         | 
| 38 | 
            -
              at:  | 
| 38 | 
            +
              at: https://www.zoho.com/projects/help/rest-api/zohoprojectsapi.html'
         | 
| 39 39 | 
             
            email:
         | 
| 40 | 
            -
            -  | 
| 40 | 
            +
            - sahaya.ramesh@zohocorp.com
         | 
| 41 41 | 
             
            executables: []
         | 
| 42 42 | 
             
            extensions: []
         | 
| 43 43 | 
             
            extra_rdoc_files: []
         |