Class: Transifex::Client

Inherits:
Object
  • Object
show all
Includes:
Request
Defined in:
lib/transifex/client.rb

Instance Method Summary collapse

Methods included from Request

#connection, #get, #set_credentials

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
# File 'lib/transifex/client.rb', line 7

def initialize(options = {})
  set_credentials(
    options[:username] || Transifex.username,
    options[:password] || Transifex.password
  )
end

Instance Method Details

#project(slug) ⇒ Object



20
21
22
23
24
# File 'lib/transifex/client.rb', line 20

def project(slug)
  Transifex::Project.new(get("/project/#{slug}/")).tap do |project|
    project.client = self
  end
end

#projectsObject



14
15
16
17
18
# File 'lib/transifex/client.rb', line 14

def projects
  get('/projects/').map do |project|
    Transifex::Project.new(project).tap {|p| p.client = self }
  end
end