App42_Ruby_API 0.8.4

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.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/App42_Ruby_API.gemspec +33 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +29 -0
  7. data/Rakefile +1 -0
  8. data/TODO.rb +3 -0
  9. data/lib/App42_Ruby_API.rb +232 -0
  10. data/lib/App42_Ruby_API/App42BadParameterException.rb +31 -0
  11. data/lib/App42_Ruby_API/App42Exception.rb +39 -0
  12. data/lib/App42_Ruby_API/App42LimitException.rb +15 -0
  13. data/lib/App42_Ruby_API/App42NotFoundException.rb +15 -0
  14. data/lib/App42_Ruby_API/App42Response.rb +13 -0
  15. data/lib/App42_Ruby_API/App42ResponseBuilder.rb +67 -0
  16. data/lib/App42_Ruby_API/App42SecurityException.rb +15 -0
  17. data/lib/App42_Ruby_API/version.rb +3 -0
  18. data/lib/connection/RESTConnection.rb +713 -0
  19. data/lib/email/Email.rb +51 -0
  20. data/lib/email/EmailMIME.rb +51 -0
  21. data/lib/email/EmailResponseBuilder.rb +76 -0
  22. data/lib/email/EmailService.rb +244 -0
  23. data/lib/gallery/Album.rb +56 -0
  24. data/lib/gallery/AlbumResponseBuilder.rb +168 -0
  25. data/lib/gallery/AlbumService.rb +337 -0
  26. data/lib/gallery/PhotoService.rb +591 -0
  27. data/lib/game/Game.rb +39 -0
  28. data/lib/game/GameResponseBuilder.rb +106 -0
  29. data/lib/game/GameService.rb +268 -0
  30. data/lib/game/Reward.rb +24 -0
  31. data/lib/game/RewardResponseBuilder.rb +85 -0
  32. data/lib/game/RewardService.rb +440 -0
  33. data/lib/game/ScoreBoardService.rb +433 -0
  34. data/lib/game/ScoreService.rb +157 -0
  35. data/lib/geo/Geo.rb +51 -0
  36. data/lib/geo/GeoPoint.rb +43 -0
  37. data/lib/geo/GeoResponseBuilder.rb +145 -0
  38. data/lib/geo/GeoService.rb +505 -0
  39. data/lib/imageProcessor/Image.rb +42 -0
  40. data/lib/imageProcessor/ImageProcessorResponseBuilder.rb +40 -0
  41. data/lib/imageProcessor/ImageProcessorService.rb +1054 -0
  42. data/lib/log/Log.rb +49 -0
  43. data/lib/log/LogResponseBuilder.rb +61 -0
  44. data/lib/log/LogService.rb +920 -0
  45. data/lib/message/Queue.rb +50 -0
  46. data/lib/message/QueueResponseBuilder.rb +64 -0
  47. data/lib/message/QueueService.rb +469 -0
  48. data/lib/push/DeviceType.rb +56 -0
  49. data/lib/push/PushNotification.rb +38 -0
  50. data/lib/push/PushNotificationResposneBuilder.rb +74 -0
  51. data/lib/push/PushNotificationService.rb +458 -0
  52. data/lib/recommend/PreferenceData.rb +25 -0
  53. data/lib/recommend/Recommender.rb +48 -0
  54. data/lib/recommend/RecommenderResponseBuilder.rb +70 -0
  55. data/lib/recommend/RecommenderService.rb +1092 -0
  56. data/lib/recommend/RecommenderSimilarity.rb +52 -0
  57. data/lib/review/Review.rb +38 -0
  58. data/lib/review/ReviewResponseBuilder.rb +76 -0
  59. data/lib/review/ReviewService.rb +590 -0
  60. data/lib/session/Session.rb +43 -0
  61. data/lib/session/SessionResponseBuilder.rb +70 -0
  62. data/lib/session/SessionService.rb +427 -0
  63. data/lib/shopping/Cart.rb +77 -0
  64. data/lib/shopping/CartResponseBuilder.rb +118 -0
  65. data/lib/shopping/CartService.rb +902 -0
  66. data/lib/shopping/Catalogue.rb +79 -0
  67. data/lib/shopping/CatalogueResponseBuilder.rb +170 -0
  68. data/lib/shopping/CatalogueService.rb +649 -0
  69. data/lib/shopping/ItemData.rb +29 -0
  70. data/lib/shopping/PaymentStatus.rb +60 -0
  71. data/lib/social/Social.rb +35 -0
  72. data/lib/social/SocialResponseBuilder.rb +38 -0
  73. data/lib/social/SocialService.rb +585 -0
  74. data/lib/storage/OrderByType.rb +29 -0
  75. data/lib/storage/Query.rb +39 -0
  76. data/lib/storage/QueryBuilder.rb +118 -0
  77. data/lib/storage/Storage.rb +45 -0
  78. data/lib/storage/StorageResponseBuilder.rb +86 -0
  79. data/lib/storage/StorageService.rb +775 -0
  80. data/lib/upload/Upload.rb +40 -0
  81. data/lib/upload/UploadFileType.rb +83 -0
  82. data/lib/upload/UploadResponseBuilder.rb +58 -0
  83. data/lib/upload/UploadService.rb +960 -0
  84. data/lib/user/User.rb +102 -0
  85. data/lib/user/UserResponseBuilder.rb +105 -0
  86. data/lib/user/UserService.rb +1209 -0
  87. data/lib/util/util.rb +244 -0
  88. data/question.rb +79 -0
  89. metadata +204 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c71aa806e3f15c996579eb6837b4515239c021c2
4
+ data.tar.gz: 6a7c3892a221b1f577f01587a6c8910073052042
5
+ SHA512:
6
+ metadata.gz: 8a7cd49aac1c720f25f3d3e55724d37b5b36d847d8c966cbdb6e7166a22920073382394daf4ff44598786a3930427e34f510e90d38001ba100512e03b9a6dbc1
7
+ data.tar.gz: fd7fd5eb6b2d7949d4d56b623db22b4bd64f6cb2cc5e98a50e48b7d9489b3efa873a6248ba729f2e02d5e6345c5956ac640bb3972a7211678f8de45eda8fd7a0
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ /bin/*
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ .idea/
20
+ nbproject/
21
+ garbage.rb
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'App42_Ruby_API/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "App42_Ruby_API"
8
+ spec.version = App42RubyAPI::VERSION
9
+ spec.authors = ["ShepHertz Technologies Pvt. Ltd."]
10
+ spec.email = ["http://apps.shephertz.com/"]
11
+ spec.homepage = "http://www.shephertz.com"
12
+ spec.summary = "App42 Ruby APIs"
13
+ spec.description = "gem containing all the sdk"
14
+ spec.summary = %q{App42_RUBY_API is a gem containing all the api's that will be used to create an app}
15
+ spec.license = "MIT"
16
+
17
+ spec.add_dependency "rest-client", "= 1.6.7"
18
+ spec.add_dependency "ruby-hmac", "= 0.4.0"
19
+ spec.add_dependency "json_pure", "= 1.6.6"
20
+ spec.required_rubygems_version = ">= 1.3.6"
21
+ # lol - required for validation
22
+ spec.rubyforge_project = "App42_RUBY_SDK"
23
+
24
+
25
+
26
+ spec.files = `git ls-files`.split($/)
27
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
28
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.3"
32
+ spec.add_development_dependency "rake"
33
+ end
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # App42RubyAPI
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'App42_Ruby_API'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install App42_Ruby_API
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/TODO.rb ADDED
@@ -0,0 +1,3 @@
1
+ TODO
2
+ 1. Need close look to excption CLASS
3
+
@@ -0,0 +1,232 @@
1
+ $: << File.dirname(__FILE__)
2
+ require "App42_Ruby_API/version"
3
+ require 'user/UserService'
4
+ require 'storage/Query'
5
+ require 'storage/QueryBuilder'
6
+ require 'storage/OrderByType'
7
+ require 'storage/StorageService'
8
+ require 'push/DeviceType'
9
+ require 'push/PushNotification'
10
+ require 'push/PushNotificationService'
11
+ require 'upload/UploadService'
12
+ require 'upload/UploadFileType'
13
+ require 'session/SessionService'
14
+ require 'geo/GeoService'
15
+ require 'geo/GeoPoint'
16
+ require 'gallery/AlbumService'
17
+ require 'gallery/PhotoService'
18
+ require 'log/LogService'
19
+ require 'recommend/RecommenderService'
20
+ require 'recommend/RecommenderSimilarity'
21
+ require 'game/GameService'
22
+ require 'game/RewardService'
23
+ require 'game/ScoreBoardService'
24
+ require 'game/ScoreService'
25
+ require 'review/ReviewService'
26
+ require 'social/SocialService'
27
+ require 'email/EmailService'
28
+ require 'email/EmailMIME'
29
+ require 'message/QueueService'
30
+ require 'storage/StorageService'
31
+ require 'shopping/CartService'
32
+ require 'shopping/PaymentStatus'
33
+ require 'shopping/CatalogueService'
34
+ require 'imageProcessor/ImageProcessorService'
35
+
36
+
37
+
38
+ # Should prefer CONSTANCE instead of CLASS variable if value is not getting change over execution
39
+ JSON_MIME_TYPE = "application/json"
40
+ XML_MIME_TYPE = "application/xml"
41
+
42
+ module App42RubyAPI
43
+
44
+ p 'shephertz--------------------------------------------------------------!!!'
45
+
46
+ class ServiceAPI
47
+ attr_accessor :api_key, :secret_key, :base_url, :content_type, :accept
48
+
49
+ def initialize(api_key, secret_key)
50
+ puts "Initializer Called "
51
+ @api_key = api_key
52
+ @secret_key = secret_key
53
+ @base_url = "https://api.shephertz.com/cloud/"
54
+ @content_type = JSON_MIME_TYPE
55
+ @accept = JSON_MIME_TYPE
56
+ end
57
+
58
+ def build_user_service
59
+ puts "Build User Called "
60
+ user = App42::User::UserService.new(api_key, secret_key, base_url)
61
+ user
62
+ end
63
+
64
+ def buildSessionService
65
+ puts "Build Session Called "
66
+ session = App42::Session::SessionService.new(api_key, secret_key, base_url)
67
+ session
68
+ end
69
+
70
+ def buildReviewService
71
+ puts "Build Review Called "
72
+ review = App42::Review::ReviewService.new(api_key, secret_key, base_url)
73
+ review
74
+ end
75
+
76
+ def buildSocialService
77
+ puts "Build social Called "
78
+ social = App42::Social::SocialService.new(api_key, secret_key, base_url)
79
+ social
80
+ end
81
+
82
+ def buildEmailService
83
+ puts "Build email service Called "
84
+ email = App42::Email::EmailService.new(api_key, secret_key, base_url)
85
+ email
86
+ end
87
+
88
+ def buildAlbumService
89
+ puts "Build Album service Called "
90
+ album = App42::Gallery::AlbumService.new(api_key, secret_key, base_url)
91
+ album
92
+ end
93
+
94
+ def buildPhotoService
95
+ puts "Build Photo service Called "
96
+ photo = App42::Gallery::PhotoService.new(api_key, secret_key, base_url)
97
+ photo
98
+ end
99
+
100
+ def buildGameService
101
+ puts "Build Game service Called "
102
+ game = App42::Game::GameService.new(api_key, secret_key, base_url)
103
+ game
104
+ end
105
+
106
+ def buildRewardService
107
+ puts "Build Reward service Called "
108
+ reward = App42::Game::RewardService.new(api_key, secret_key, base_url)
109
+ reward
110
+ end
111
+
112
+ def buildScoreBoardService
113
+ puts "Build Score Board service Called "
114
+ scoreboard = App42::Game::ScoreBoardService.new(api_key, secret_key, base_url)
115
+ scoreboard
116
+ end
117
+
118
+ def buildScoreService
119
+ puts "Build Score service Called "
120
+ score = App42::Game::ScoreService.new(api_key, secret_key, base_url)
121
+ score
122
+ end
123
+
124
+ def buildQueueService
125
+ puts "Build Queue service Called "
126
+ queue = App42::Message::QueueService.new(api_key, secret_key, base_url)
127
+ queue
128
+ end
129
+
130
+ def buildStorageService
131
+ puts "Build Storage service Called "
132
+ storage = App42::Storage::StorageService.new(api_key, secret_key, base_url)
133
+ storage
134
+ end
135
+
136
+ def buildCartService
137
+ puts "Build Cart Called "
138
+ cart = App42::Shopping::CartService.new(api_key, secret_key, base_url)
139
+ cart
140
+ end
141
+
142
+ def buildStorageService
143
+ puts "build Storage service Called "
144
+ storage = App42::Storage::StorageService.new(api_key, secret_key, base_url)
145
+ storage
146
+ end
147
+
148
+ def buildUploadService
149
+ puts "upload Storage service Called "
150
+ upload = App42::Upload::UploadService.new(api_key, secret_key, base_url)
151
+ upload
152
+ end
153
+
154
+ def buildImageProcessorService
155
+ puts "Build Image Processor service Called "
156
+ image = App42::ImageProcessor::ImageProcessorService.new(api_key, secret_key, base_url)
157
+ image
158
+ end
159
+
160
+ def buildCatalogueService
161
+ puts "Build Catalogue service Called "
162
+ catalogue = App42::Shopping::CatalogueService.new(api_key, secret_key, base_url)
163
+ catalogue
164
+ end
165
+
166
+ def buildLogService
167
+ puts "Build Log service Called "
168
+ log = App42::Log::LogService.new(api_key, secret_key, base_url)
169
+ log
170
+ end
171
+
172
+ def buildGeoService
173
+ puts "Build Geo service Called "
174
+ geo = App42::Geo::GeoService.new(api_key, secret_key, base_url)
175
+ geo
176
+ end
177
+
178
+ def buildRecommendService
179
+ puts "Build Recommender service Called "
180
+ recommend = App42::Recommend::RecommenderService.new(api_key, secret_key, base_url)
181
+ recommend
182
+ end
183
+
184
+ def buildBillService
185
+ puts "Build Bill service Called "
186
+ bill = App42::AppTab::BillService.new(api_key, secret_key, base_url)
187
+ bill
188
+ end
189
+
190
+ def buildLicenseService
191
+ puts "Build License service Called "
192
+ license = App42::AppTab::LicenseService.new(api_key, secret_key, base_url)
193
+ license
194
+ end
195
+
196
+ def buildUsageService
197
+ puts "Build Usage service Called "
198
+ usage = App42::AppTab::UsageService.new(api_key, secret_key, base_url)
199
+ usage
200
+ end
201
+
202
+ def buildPushNotificationService
203
+ puts "Build Push Notification service Called "
204
+ push = App42::Push::PushNotificationService.new(api_key, secret_key, base_url)
205
+ push
206
+ end
207
+
208
+ def buildSchemeService
209
+ puts "Build Scheme service Called "
210
+ scheme = App42::AppTab::SchemeService.new(api_key, secret_key, base_url)
211
+ scheme
212
+ end
213
+
214
+ def buildPackageService
215
+ puts "Build Scheme service Called "
216
+ package = App42::AppTab::PackageService.new(api_key, secret_key, base_url)
217
+ package
218
+ end
219
+
220
+ def buildDiscountService
221
+ puts "Build Discount service Called "
222
+ discount = App42::AppTab::DiscountService.new(api_key, secret_key, base_url)
223
+ discount
224
+ end
225
+
226
+
227
+
228
+ end
229
+ end
230
+
231
+
232
+
@@ -0,0 +1,31 @@
1
+ #
2
+ # -----------------------------------------------------------------------
3
+ # Copyright © 2012 ShepHertz Technologies Pvt Ltd. All rights reserved.
4
+ # -----------------------------------------------------------------------
5
+
6
+ require 'App42_Ruby_API/App42Exception'
7
+
8
+ class App42BadParameterException < App42Exception
9
+
10
+ attr_accessor :http_error_code, :app_error_code, :detailMessage
11
+ def initialize(*args)
12
+ if args.size == 1
13
+ super(args[0])
14
+ self::initialize1(args[0])
15
+ elsif args.size == 3
16
+ super(args[0])
17
+ self::initialize3(args[0], args[1], args[2])
18
+ end
19
+
20
+ end
21
+
22
+ def initialize1(detailMessage)
23
+ # super(detailMessage)
24
+ end
25
+
26
+ def initialize3(detailMessage, http_error_code, app_error_code)
27
+ super(detailMessage,http_error_code,app_error_code)
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,39 @@
1
+ #
2
+ # -----------------------------------------------------------------------
3
+ # Copyright © 2012 ShepHertz Technologies Pvt Ltd. All rights reserved.
4
+ # -----------------------------------------------------------------------
5
+
6
+ class App42Exception < Exception
7
+
8
+ attr_accessor :http_error_code, :app_error_code, :detailMessage
9
+ def initialize(*args)
10
+
11
+ if args.size == 1
12
+ super(args[0])
13
+ self::initialize1(args[0])
14
+ elsif args.size == 2
15
+ super(args[0])
16
+ self::initialize2(args[0], args[1])
17
+ elsif args.size == 3
18
+ super(args[0])
19
+ self::initialize3(args[0], args[1], args[2])
20
+ end
21
+
22
+ end
23
+
24
+ def initialize1(detailMessage)
25
+ @detailMessage = detailMessage
26
+ end
27
+
28
+ def initialize2(http_error_code,app_error_code)
29
+ @http_error_code = http_error_code
30
+ @pp_error_code = app_error_code
31
+ end
32
+
33
+ def initialize3(detailMessage, http_error_code, app_error_code)
34
+ @http_error_code = http_error_code
35
+ @app_error_code = app_error_code
36
+ @detailMessage = detailMessage
37
+ end
38
+
39
+ end
@@ -0,0 +1,15 @@
1
+ #
2
+ # -----------------------------------------------------------------------
3
+ # Copyright © 2012 ShepHertz Technologies Pvt Ltd. All rights reserved.
4
+ # -----------------------------------------------------------------------
5
+
6
+ require 'App42_Ruby_API/App42Exception'
7
+
8
+ class App42LimitException < App42Exception
9
+
10
+ attr_accessor :http_error_code, :app_error_code, :detailMessage
11
+ def initialize(detailMessage, http_error_code, app_error_code)
12
+ super(detailMessage,http_error_code,app_error_code)
13
+ end
14
+
15
+ end