promptcloud_data_api 0.0.1.beta2 → 0.0.1.beta3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
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 query indexed data from promptcloud.
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
- For any queries related to this gem, contact data-api-gem@promptcloud.com.
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
- #above method will put the downloaded files in ~/promptcloud/downloads
31
- #to override promptcloudhome (~/promptcloud), provide arg- :promptcloudhome=>"complete path of other dir"
32
- #to override download dir provide arg- :download_dir => "<download dir full path>"
33
- #to override conf dir provide arg- :apiconf => "<api conf full path>"
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
- #above command will put the downloaded files in ~/promptcloud/downloads
40
- #log file can be viewed at ~/promptcloud/log/*log
41
- #api config file at ~/promptcloud/configs/config.yml
42
- #to override the downloaded file use option --download_dir "<apidir full path>"
43
- #to override config dir use option --apiconf "<apiconf full path>"
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
 
@@ -168,9 +168,9 @@ class PromptCloudApi
168
168
 
169
169
  private
170
170
  def get_api_url(options)
171
- promptcloud_api_query="http://api.promptcloud.com/data/info?id=#{@client_id}"
171
+ promptcloud_api_query="https://api.promptcloud.com/data/info?id=#{@client_id}"
172
172
  if options[:bcp]
173
- promptcloud_api_query="http://bcp.promptcloud.com/data/info?id=#{@client_id}"
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 "
@@ -1,3 +1,3 @@
1
1
  module PromptcloudDataApi
2
- VERSION = "0.0.1.beta2"
2
+ VERSION = "0.0.1.beta3"
3
3
  end
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.beta2
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: 2012-10-23 00:00:00.000000000 Z
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.24
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