Sha256: b823b06a473efeafddada6c570390bb5a2ac808f568407dbdd5392e374dc967b

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

module Paymo
  class Entry

    attr_accessor :id, :added_manually, :billed, :start, :end, :description, :user_id, :user_name, 
                  :task_id, :task_name, :project_id, :project_name

    def initialize(result)
      @id             = result['id'].to_i
      @added_manually = !!result['added_manually']
      @billed         = !!result['billed']
      @start          = DateTime.parse(result['start']['_content'])
      @end            = DateTime.parse(result['end']['_content'])
      @description    = result['description']['_content']
      @user_id        = result['user']['id'].to_i
      @user_name      = result['user']['name']
      @task_id        = result['task']['id'].to_i
      @task_name      = result['task']['name']
      @project_id     = result['project']['id'].to_i
      @project_name   = result['project']['name']
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paymo-0.0.2 lib/paymo/models/entry.rb
paymo-0.0.1 lib/paymo/models/entry.rb