Class: Txbr::Uploader
- Inherits:
-
Object
- Object
- Txbr::Uploader
- Defined in:
- lib/txbr/uploader.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(project) ⇒ Uploader
constructor
A new instance of Uploader.
- #upload_all ⇒ Object
- #upload_resource(resource) ⇒ Object
Constructor Details
#initialize(project) ⇒ Uploader
Returns a new instance of Uploader.
5 6 7 |
# File 'lib/txbr/uploader.rb', line 5 def initialize(project) @project = project end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
3 4 5 |
# File 'lib/txbr/uploader.rb', line 3 def project @project end |
Instance Method Details
#upload_all ⇒ Object
9 10 11 12 13 |
# File 'lib/txbr/uploader.rb', line 9 def upload_all project.handler.each_resource do |resource| upload_resource(resource) end end |
#upload_resource(resource) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/txbr/uploader.rb', line 15 def upload_resource(resource) stream = StringIO.new resource.write_to(stream) project.transifex_api.create_or_update( resource.tx_resource, stream.string ) end |