Sha256: ef5be94cc18393109660002561dcb05cd751e39316517d4b0e9fadd90c98e434

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

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 details
      @details || details!
    end

    def details!
      @details = client.get("/project/#{@slug}?details")
    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

1 entries across 1 versions & 1 rubygems

Version Path
transifex-ruby-fork-jg-0.1.0 lib/transifex/project.rb