Class: Transifex::Client
- Inherits:
-
Object
- Object
- Transifex::Client
- Includes:
- Request
- Defined in:
- lib/transifex/client.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #project(slug) ⇒ Object
- #projects ⇒ Object
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( = {}) set_credentials( [:username] || Transifex.username, [: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 |
#projects ⇒ Object
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 |