Sha256: bde63446f699b3c2f1d6c90eee129de9fe4275a5ef2b347667b0f1d1cad1ca0f

Contents?: true

Size: 849 Bytes

Versions: 4

Compression:

Stored size: 849 Bytes

Contents

module Transifex
  class Resource
    attr_accessor :client, :category, :i18n_type, :source_language_code, :slug, :name

    def initialize(project_slug, transifex_data)
      @project_slug = project_slug
      @name = transifex_data[:name]
      @category = transifex_data[:category]
      @i18n_type = transifex_data[:i18n_type]
      @source_language_code = transifex_data[:source_language_code]
      @slug = transifex_data[:slug]
    end

    def content
      client.get("/project/#{@project_slug}/resource/#{@slug}/content/")
    end

    def translation(lang)
      client.get("/project/#{@project_slug}/resource/#{@slug}/translation/#{lang}/")
    end

    def stats(lang)
      stats = client.get("/project/#{@project_slug}/resource/#{@slug}/stats/#{lang}")
      Transifex::Stats.new(stats).tap {|r| r.client = client }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
transifex-ruby-0.1.0 lib/transifex/resource.rb
transifex-ruby-0.0.6 lib/transifex/resource.rb
transifex-ruby-0.0.5 lib/transifex/resource.rb
transifex-ruby-0.0.4 lib/transifex/resource.rb