promptcloud_data_api 0.0.1.beta2 → 0.0.1.beta3
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.
- data/.gitignore +18 -0
- data/README.md +15 -12
- data/lib/promptcloud_data_api.rb +9 -3
- data/lib/promptcloud_data_api/version.rb +1 -1
- metadata +4 -3
data/.gitignore
ADDED
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# PromptCloudDataAPI
|
2
2
|
|
3
|
-
This is PromptCloud's (promptcloud.com) API gem. It can be used to
|
4
|
-
NOTE: API query requires a valid userid and password.
|
3
|
+
This is PromptCloud's (http://promptcloud.com) data API gem. It can be used to fetch the client specific data from PromptCloud data api.
|
5
4
|
|
6
|
-
|
5
|
+
NOTE: API query requires a valid userid and password.
|
6
|
+
|
7
|
+
For queries related to this gem please contact the folks at promptcloud or open a github issue
|
7
8
|
|
8
9
|
## Installation
|
9
10
|
Option 1-
|
@@ -27,20 +28,22 @@ Access using program:
|
|
27
28
|
require 'promptcloud_data_api'
|
28
29
|
obj=PromptCloudApi.new
|
29
30
|
obj.download_files({:user => "<your valid user name>", :pass => "<your valid password>", :timestamp=> <timestamp>[optional], :category=> "<category>"[optional]})
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
|
32
|
+
* Above method will put the downloaded files in ~/promptcloud/downloads
|
33
|
+
* To override promptcloudhome (~/promptcloud), provide arg- :promptcloudhome=>"complete path of other dir"
|
34
|
+
* To override download dir provide arg- :download_dir => "<download dir full path>"
|
35
|
+
* To override conf dir provide arg- :apiconf => "<api conf full path>"
|
34
36
|
|
35
37
|
Access using Command line:
|
36
38
|
|
37
39
|
get_promptcloud_data -h #will display help
|
38
40
|
get_promptcloud_data --user <username> --pass <password> [--category <category>] [--timestamp <timestamp>]
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
|
42
|
+
* Above command will put the downloaded files in ~/promptcloud/downloads
|
43
|
+
* Log file can be viewed at ~/promptcloud/log/*log
|
44
|
+
* Api config file at ~/promptcloud/configs/config.yml
|
45
|
+
* To override the downloaded file use option --download_dir "<apidir full path>"
|
46
|
+
* To override config dir use option --apiconf "<apiconf full path>"
|
44
47
|
|
45
48
|
In command line tool, if option --perform_initial_setup is provided along with other options, then initial setup will be performed (create conf file, download dir)
|
46
49
|
|
data/lib/promptcloud_data_api.rb
CHANGED
@@ -168,9 +168,9 @@ class PromptCloudApi
|
|
168
168
|
|
169
169
|
private
|
170
170
|
def get_api_url(options)
|
171
|
-
promptcloud_api_query="
|
171
|
+
promptcloud_api_query="https://api.promptcloud.com/data/info?id=#{@client_id}"
|
172
172
|
if options[:bcp]
|
173
|
-
promptcloud_api_query="
|
173
|
+
promptcloud_api_query="https://api.bcp.promptcloud.com/data/info?id=#{@client_id}"
|
174
174
|
end
|
175
175
|
|
176
176
|
if options[:timestamp]
|
@@ -210,7 +210,13 @@ class PromptCloudApi
|
|
210
210
|
begin
|
211
211
|
promptcloud_api_query=get_api_url(options)
|
212
212
|
api_query_output=""
|
213
|
-
RestClient.get(promptcloud_api_query) do |response|
|
213
|
+
RestClient.get(promptcloud_api_query) do |response, request, result, &block|
|
214
|
+
if [301, 302, 307].include? response.code
|
215
|
+
response.follow_redirection(request, result, &block)
|
216
|
+
else
|
217
|
+
response.return!(request, result, &block)
|
218
|
+
end
|
219
|
+
puts "res code: #{response.code}"
|
214
220
|
if response.code!=200
|
215
221
|
if options[:bcp]
|
216
222
|
$stderr.puts "bcp too is down :(, please mail downtime@promptcloud.com "
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promptcloud_data_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.beta3
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -36,6 +36,7 @@ executables:
|
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
+
- .gitignore
|
39
40
|
- Gemfile
|
40
41
|
- LICENSE.txt
|
41
42
|
- README.md
|
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
65
|
version: 1.3.1
|
65
66
|
requirements: []
|
66
67
|
rubyforge_project:
|
67
|
-
rubygems_version: 1.8.
|
68
|
+
rubygems_version: 1.8.23
|
68
69
|
signing_key:
|
69
70
|
specification_version: 3
|
70
71
|
summary: use it to query promptcloud indexed data
|