Sha256: a9ca1c3b34336469f4a05e4c01cd7fcf7ada7e09f344e1b0d946054a1f39f58b

Contents?: true

Size: 655 Bytes

Versions: 4

Compression:

Stored size: 655 Bytes

Contents

# frozen_string_literal: true

require 'active_resource'

module Toggl
  module CustomJsonFormat
    include ActiveResource::Formats::JsonFormat

    # rubocop:disable Style/ModuleFunction
    extend self
    # rubocop:enable Style/ModuleFunction

    def decode(json)
      ActiveSupport::JSON.decode(json)['data']
    end
  end

  class Detail < ActiveResource::Base
    self.format = CustomJsonFormat
    self.site = 'https://toggl.com/reports/api/v2'
    self.include_root_in_json = true
    self.include_format_in_path = false

    def self.user
      RenuoCliConfig.toggl_api_token
    end

    def self.password
      'api_token'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
renuo-cli-4.5.0 lib/renuo/cli/app/toggl/detail.rb
renuo-cli-4.3.0 lib/renuo/cli/app/toggl/detail.rb
renuo-cli-4.2.1 lib/renuo/cli/app/toggl/detail.rb
renuo-cli-4.2.0 lib/renuo/cli/app/toggl/detail.rb