Sha256: 0e9b3221f337c5bfda4ce3e4b928be187760e537f850711dca9bcbd03d134c0e

Contents?: true

Size: 701 Bytes

Versions: 2

Compression:

Stored size: 701 Bytes

Contents

module Paymo
  class Projects

    def get_info(project_id)
      result = Paymo::API.get :projects, :get_info, project_id: project_id
      if result['status'] == 'ok'
        Paymo::Project.new(result['project'])
      end
    end

    def get_list(options = {})
      result = Paymo::API.get :projects, :get_list, options
      if result['status'] == 'ok'
        projects = []
        result['projects']['project'].each do |project|
          # p project
          projects << project
          # projects << Paymo::Project.new(project)
        end
        projects.select { |a| a['retired'] == 0 }.uniq{ |c| c['client']['id'] }.each { |p| puts p['client']['name']  }
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paymo-0.0.2 lib/paymo/resources/projects.rb
paymo-0.0.1 lib/paymo/resources/projects.rb