codepicnic 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 868f6593e8ed07ae54ce782093ecb7ed05163329
4
- data.tar.gz: 452007422de1c204a9614a08af1ed35787d55711
3
+ metadata.gz: 888acb3dad7df628e8f311dbf1de0a1c1aaad55d
4
+ data.tar.gz: 4ff6ab324e928d28105953e1dd29154a4d56de30
5
5
  SHA512:
6
- metadata.gz: 78909c774649f51ae11ae7afb47173187bcb075df72fbf0cce8882540b5d8ba8f351f3715ec5c391e7694ef4c6e595a1d7673531ccbc1109fd5eb67d0b15fb5b
7
- data.tar.gz: 494a06e085faadf0f2858b994114882541c06da6a2390dfe29083032d5a176f055de2881f2fa2052b732f3a588167f5b07464340542be4a57ce1f77f8de4e658
6
+ metadata.gz: ab017b7b7f9247184b68862b3af353de45b9eae578785bccc4b3fdc04a1460ad01f1d705232e7b1ae5b50cc21219301e30282a8abd408b58ef679fbd37ddc208
7
+ data.tar.gz: 76bb21266d4ea30a70c2636c218c29280fd05e79dc2e59802439b748d8336dc7283f26bdf3481be5f983373ffc99a59143c15d5501629bdf28e7676499235255
@@ -16,11 +16,17 @@ module CodePicnic
16
16
  self.class.post(url, params)
17
17
  end
18
18
 
19
+ def post_form(url, params = {})
20
+ self.class.post_form(url, params)
21
+ end
22
+
19
23
  module ClassMethods
20
24
 
21
25
  def url_to(container_name = nil, verb = nil)
22
26
  return Console.api_url if container_name.nil?
23
- "#{Console.api_url}/#{container_name}/#{verb}"
27
+ url = "#{Console.api_url}/#{container_name}"
28
+ url << "/#{verb}" if verb
29
+ url
24
30
  end
25
31
 
26
32
  def get(url)
@@ -31,6 +37,10 @@ module CodePicnic
31
37
  Request.post(url, params)
32
38
  end
33
39
 
40
+ def post_form(url, params)
41
+ Request.post_form(url, params)
42
+ end
43
+
34
44
  end
35
45
  end
36
46
 
@@ -60,6 +60,15 @@ module CodePicnic
60
60
  post url_to(@container_name, "exec"), {commands: commands}
61
61
  end
62
62
 
63
+ def upload_file(file = nil, path = nil)
64
+ path = "/app/#{file.path}" unless path
65
+ post_form url_to(@container_name, "upload_file"), {path: path, file: file}
66
+ end
67
+
68
+ def search(term, path)
69
+ get url_to(@container_name, "search")
70
+ end
71
+
63
72
  private
64
73
 
65
74
  def cleaned_params
@@ -76,6 +85,10 @@ module CodePicnic
76
85
  get(url_to)["consoles"].map{|data| Console.new(data) }
77
86
  end
78
87
 
88
+ def find(container_name)
89
+ Console.new(get(url_to(container_name)))
90
+ end
91
+
79
92
  def batch_exec(commands = [], container_names = [])
80
93
  post url_to(nil, "exec"), {commands: commands, container_names: container_names }
81
94
  end
@@ -10,6 +10,10 @@ module CodePicnic
10
10
  def post(url, params = {})
11
11
  JSON.parse(RestClient.post "#{url}.json", params.to_json, {'Authorization' => "Bearer #{CodePicnic.token}", "Content-Type" => "application/json; charset=utf-8"})
12
12
  end
13
+
14
+ def post_form(url, params = {})
15
+ JSON.parse(RestClient.post "#{url}.json", params, {'Authorization' => "Bearer #{CodePicnic.token}", "Content-Type" => "application/x-www-form-urlencoded; charset=utf-8"})
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,3 +1,3 @@
1
1
  module CodePicnic
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codepicnic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alvaro Pereyra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-13 00:00:00.000000000 Z
11
+ date: 2016-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler