artifacia 0.1.2 → 0.1.2.1
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 +4 -4
- data/artifacia.gemspec +1 -1
- data/lib/artifacia.rb +15 -13
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 430377b9bb0f81cfab96ba1574415096a5feddb6
|
|
4
|
+
data.tar.gz: 4b7c021939eeef44a38313833d9cff9fc7e98f43
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e43e9a23b117fe526a272b366c84053dd3f33a2ad3b21a6998733ca8182a32189adec073043a124e3774358c8b0ad146724d5426839e95351814c0d36aa9e5e3
|
|
7
|
+
data.tar.gz: 79cd2a883bfbaf2d7b728cc6d339ccbac4917efaba270cef8bc5a5e2513658f581969a46ec30c6480d56188e03a0d6cea98c2d1c24b8d5f72fa473d1b393cba5
|
data/artifacia.gemspec
CHANGED
data/lib/artifacia.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
require 'net/
|
|
2
|
-
|
|
1
|
+
require 'net/https'
|
|
3
2
|
require 'rubygems'
|
|
4
3
|
require 'json'
|
|
5
4
|
|
|
@@ -8,14 +7,17 @@ class Client
|
|
|
8
7
|
@user = username
|
|
9
8
|
@pass = password
|
|
10
9
|
@host = 'api.artifacia.com'
|
|
10
|
+
@port = 443
|
|
11
|
+
@http = Net::HTTP.new(@host, @port)
|
|
12
|
+
@http.use_ssl = true
|
|
13
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
11
14
|
end
|
|
12
15
|
|
|
13
16
|
def upload_user_purchased_items(user_id, data)
|
|
14
17
|
@post_ws = "/v1/users/#{user_id}/purchased_items"
|
|
15
18
|
req = Net::HTTP::Post.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
|
|
16
19
|
req.basic_auth @user, @pass
|
|
17
|
-
|
|
18
|
-
response = Net::HTTP.new(@host).start {|http| http.request(req) }
|
|
20
|
+
response = @http.request(req)
|
|
19
21
|
return response.body
|
|
20
22
|
end
|
|
21
23
|
|
|
@@ -24,7 +26,7 @@ class Client
|
|
|
24
26
|
req = Net::HTTP::Post.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
|
|
25
27
|
req.basic_auth @user, @pass
|
|
26
28
|
req.body = data
|
|
27
|
-
response =
|
|
29
|
+
response = @http.request(req)
|
|
28
30
|
return response.body
|
|
29
31
|
end
|
|
30
32
|
|
|
@@ -33,7 +35,7 @@ class Client
|
|
|
33
35
|
req = Net::HTTP::Post.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
|
|
34
36
|
req.basic_auth @user, @pass
|
|
35
37
|
req.body = data
|
|
36
|
-
response =
|
|
38
|
+
response = @http.request(req)
|
|
37
39
|
return response.body
|
|
38
40
|
end
|
|
39
41
|
|
|
@@ -42,31 +44,31 @@ class Client
|
|
|
42
44
|
req = Net::HTTP::Delete.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
|
|
43
45
|
req.basic_auth @user, @pass
|
|
44
46
|
req.body = item_ids
|
|
45
|
-
response =
|
|
47
|
+
response = @http.request(req)
|
|
46
48
|
return response.body
|
|
47
49
|
end
|
|
48
50
|
|
|
49
51
|
def get_visual_recommendation(prod_id, num)
|
|
50
52
|
@post_ws = "/v1/recommendation/similar/#{prod_id}/#{num}"
|
|
51
|
-
req = Net::HTTP::Get.new(@post_ws
|
|
53
|
+
req = Net::HTTP::Get.new(@post_ws)
|
|
52
54
|
req.basic_auth @user, @pass
|
|
53
|
-
response =
|
|
55
|
+
response = @http.request(req)
|
|
54
56
|
return response.body
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
def get_cpr_recommendation(prod_id, num)
|
|
58
60
|
@post_ws = "/v1/recommendation/collections/#{prod_id}/#{num}"
|
|
59
|
-
req = Net::HTTP::Get.new(@post_ws
|
|
61
|
+
req = Net::HTTP::Get.new(@post_ws)
|
|
60
62
|
req.basic_auth @user, @pass
|
|
61
|
-
response =
|
|
63
|
+
response = @http.request(req)
|
|
62
64
|
return response.body
|
|
63
65
|
end
|
|
64
66
|
|
|
65
67
|
def get_personalized_recommendation(user_id, num)
|
|
66
68
|
@post_ws = "/v1/recommendation/user/#{user_id}/#{num}"
|
|
67
|
-
req = Net::HTTP::Get.new(@post_ws
|
|
69
|
+
req = Net::HTTP::Get.new(@post_ws)
|
|
68
70
|
req.basic_auth @user, @pass
|
|
69
|
-
response =
|
|
71
|
+
response = @http.request(req)
|
|
70
72
|
return response.body
|
|
71
73
|
end
|
|
72
74
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: artifacia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.2
|
|
4
|
+
version: 0.1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ashish Kumar
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-08-
|
|
11
|
+
date: 2016-08-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A ruby client to integrate visual recommendation feature from Artifacia
|
|
14
14
|
API
|