Class: Themebox::Client
- Inherits:
-
Object
- Object
- Themebox::Client
- Defined in:
- lib/themebox/client.rb
Instance Method Summary collapse
- #delete_file(path) ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #resource_path(path) ⇒ Object
- #upload_file(path, file) ⇒ Object
Constructor Details
#initialize(token) ⇒ Client
Returns a new instance of Client.
2 3 4 |
# File 'lib/themebox/client.rb', line 2 def initialize(token) @token = token end |
Instance Method Details
#delete_file(path) ⇒ Object
15 16 17 18 |
# File 'lib/themebox/client.rb', line 15 def delete_file(path) puts "Deleting #{path}" RestClient.delete resource_path(path) end |
#resource_path(path) ⇒ Object
20 21 22 |
# File 'lib/themebox/client.rb', line 20 def resource_path(path) "http://tablefillr.dev/themes/#{path.sub(/\.liquid$/, '')}" end |
#upload_file(path, file) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/themebox/client.rb', line 6 def upload_file(path, file) upload_path = "http://tablefillr.dev/themes/#{path.sub(/\.liquid$/, '')}" puts "Uploading #{path}" RestClient.put resource_path(path), :content => file, :token => @token, :content_type => "application/x-www-form-urlencoded" end |