Giter Site home page Giter Site logo

liquidplanner / api-examples Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 10.0 64 KB

Example of using the LiquidPlanner Classic API

C# 8.86% Makefile 0.74% C++ 16.05% C 0.18% Go 3.27% Java 13.19% JavaScript 6.17% Perl 3.64% PHP 11.47% Python 14.06% Ruby 12.70% Raku 1.60% Visual Basic .NET 8.08%

api-examples's Introduction

LiquidPlanner Ruby Gem

The LiquidPlanner ruby gem provides a simple way to access LiquidPlanner's API. The examples directory demonstrates how to perform some common tasks with this gem.

Documentation

Installation

The LiquidPlanner API client can be installed with Rubygems or Bundler.

Rubygems

gem install liquidplanner

Bundler

Add to your Gemfile and run bundle install

gem 'liquidplanner'

Dependencies

  • activeresource >= 4.0.0
  • activesupport >= 4.0.0
  • multipart-post >= 1.0.1

Usage

Please refer to our API Guide for a full list of endpoints, resources, and attributes. Additional examples are located in this repository's examples directory.

This gem accesses the LiquidPlanner API via ActiveResource. Please read the ActiveResource documentation for additional usage details.

Create a client and connect

lp = LiquidPlanner::Base.new(:email => email, :password => password)
account = lp.account # <LiquidPlanner::Resources::Member>

Workspaces

lp.workspaces    # [<LiquidPlanner::Resources::Workspace>, <LiquidPlanner::Resources::Workspace>]
lp.workspaces(7) # Access workspace by ID

Tasks

workspace = lp.workspaces(7)                                      # Access workspace by ID
tasks     = workspace.tasks                                       # List all tasks
my_tasks  = workspace.tasks(:all, :filter => 'owner_id = me')     # Use a filter
new_task  = workspace.create_task(:name => 'Learn API')           # Create and save a new task

my_tasks.each do |task|                                           # Task details
  puts "Name: #{task.name}"
  
  if task.is_done
    puts "Completed on: #{task.done_on.to_date}"
  else
    puts "Expected finish date: #{task.expected_finish.to_date}"
  end
end

Custom Fields

workspace = lp.workspaces(7)                            # Access workspace by ID

# List custom fields
#
custom_fields = workspace.custom_fields(:all)           # List all custom fields for workspace
custom_fields.each do |custom_field|
  puts "Category: #{custom_field.category}"             # Custom field attributes
  puts "Name:     #{custom_field.name}"
  
  custom_field.values.each do |custom_field_value|      # Custom field values
    puts "ID:         #{custom_field_value.id}"
    puts "Label:      #{custom_field_value.label}"
    puts "Type:       #{custom_field_value.type}"
    puts "Sort order: #{custom_field_value.sort_order}"
  end
end

# Update a custom field value
#
custom_field = workspace.custom_fields(:first) # Access the first custom field
task = workspace.tasks(:first)                 # Access the first task

task.custom_field_values = { custom_field.name => custom_field.values.first.label }
task.save

Time Tracking

workspace = lp.workspaces(7)                # Access workspace by ID

task = workspace.tasks(                     # Get my first unfinished task
  :first, 
  :filter => ['owner_id = me', 'is_done is false']
) 

task.track_time(
  :work        => 4,                        # Log 4 hours of work 
  :activity_id => task.activities.first.id
)

Development

  1. Fork this project
  2. Make changes
  3. Add tests for your changes
  4. Commit
  5. Submit a pull request

api-examples's People

Contributors

billputer avatar jon-lp avatar josh1billion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-examples's Issues

newer API?

Is there any re-write of the examples due to newer API (v1)? More specifically, Python.

Opening short tags are not best practice.

The opening tags for the PHP files should be <?php not <? which is a short tag. Short tags are not valid on all systems by default, and may not work for all users. The file did not load for me initially, bit thankfully I knew where to look right away.

c#.net example stream disposal

Hi LP Team

The stream at line 108 should be disposed of. I'd argue it's good practice to dispose of the one at line 117 also, but that's not imperative

Phil

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.