Sha256: e70a08761b2b58f07a616a59cf9875df6fb3740a6fb3d32cec5332604ac17248

Contents?: true

Size: 911 Bytes

Versions: 4

Compression:

Stored size: 911 Bytes

Contents

module Transifex
  class Project
    attr_accessor :client, :name, :description, :source_language_code, :slug

    def initialize(transifex_data)
      @name = transifex_data[:name]
      @description = transifex_data[:description]
      @source_language_code = transifex_data[:source_langauge_code]
      @slug = transifex_data[:slug]
    end

    def resources
      client.get("/project/#{@slug}/resources/").map do |resource|
        Transifex::Resource.new(@slug, resource).tap {|r| r.client = client }
      end
    end

    def resource(resource_slug)
      resource = client.get("/project/#{@slug}/resource/#{resource_slug}")
      Transifex::Resource.new(@slug, resource).tap {|r| r.client = client }
    end

    def languages
      client.get("/project/#{@slug}/languages/").map do |language|
        Transifex::Language.new(@slug, language).tap {|r| r.client = client }
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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