artifacia 0.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -11
  3. data/artifacia.gemspec +1 -1
  4. data/lib/artifacia.rb +18 -14
  5. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e593e72b1969b6b2813cfadde0a26564e0838df6
4
- data.tar.gz: 2033b99eea0485cd06b55a2d5af1b9bd138f3c3e
3
+ metadata.gz: d0a9d771635e85cd06644d9d778058cdd1a67eab
4
+ data.tar.gz: 28c4e3d47e5e5b7b8f57627381a2732d028e2d9d
5
5
  SHA512:
6
- metadata.gz: f6709d77515c3d26f4c5556977c8e8b68da6ee29e5beffc34382d11f41b756f717aafbb36a2fb13d24458fb9bea128e6fb7f874fa65692dc3066c2c4e0aa9b73
7
- data.tar.gz: 6584752eaf3cfbd0486991858121a19109c66410cb63f287d8d99f07ddabd82b72cdbcf1decc2b3adb1a0035b2c7e1115f913f73154eb44eb0027fbb1a7b43a3
6
+ metadata.gz: 5a9a5b651247e60d6c128002fb2ba612ede9ede834ab098307900ede364f0d4990a6a403345c7474608ee51b2b6cf2d63b5bdc469a0e95f34f8e7aab9fafc3e4
7
+ data.tar.gz: c0e6c4f1941cb54c2e330039299fdb2c9ad0470c19d2505ecabd1ebc7931ed8623c5da577255ac9f397351791275188c5d59d9c384e913abd8a885883031792f
data/README.md CHANGED
@@ -2,23 +2,23 @@
2
2
 
3
3
  This ruby client is a simple wrapper around our powerful Visual Discovery [API](http://docs.artifacia.com/).
4
4
 
5
- The wrapper allows you to create your own indexes of images on which you would like to enhance the product discovery experiences. It also allows you to get various types of recommendations which are listed below.
5
+ The wrapper allows you to create your own index of images on which you would like to enhance the product discovery experiences. It also allows you to get various types of recommendations which are listed below.
6
6
 
7
7
  * Visual Recommendation
8
8
  * Cross Product Recommendation
9
- * Smart Recommendation
9
+ * Personalized Recommendation
10
10
 
11
11
  ## Installation
12
12
 
13
13
  To install the package you can follow the steps:-
14
14
 
15
15
  ```ruby
16
- rubygem install artifacia
16
+ [sudo] gem install artifacia
17
17
  ```
18
18
 
19
19
  ## Getting Started
20
20
 
21
- The API is really easy and simple to use. First you need to create an account [here]() and there you will get a username and a password. Using that credentials you can create your constructor and get stated.
21
+ The API is really easy and simple to use. First you need to visit [this](http://www.artifacia.com/requestaccess/) page and request for username and password. Using that credentials you can create your constructor and get stated.
22
22
 
23
23
  ```ruby
24
24
  require 'artifacia'
@@ -28,21 +28,23 @@ client = Client.new(user_name, password)
28
28
  ```
29
29
 
30
30
  ### Creating your index
31
- The first step is to create a index of the items that you would like to store in our databases to perform search against. If you don't have data ready right now you can quickly get started with our [sample data](). Once the data is stored and indexed we will inform you shortly.
31
+ The first step is to create a index of the items that you would like to store in our databases to perform search against. If you don't have data ready right now you can quickly get started with our [sample data](https://github.com/artifacia/artifacia-client-ruby/blob/master/sample_data.json). Once the data is stored and indexed we will inform you shortly.
32
32
 
33
- ```python
34
- import json
35
- sample_data = json.load(open("sample_data.json","rb"))
33
+ ```ruby
34
+ sample_data = File.read("sample_data.json")
36
35
  data_indexing_response = client.upload_item_data(sample_data)
37
- print data_indexing_response
36
+ puts data_indexing_response
38
37
  ```
39
38
 
40
39
  ### Performing Visual Recommendation
40
+
41
41
  Once you receive a notification form us about the status of the indexed data, you are ready to search.
42
- You can search for a product ID indexed in the sample data you inserted/uploaded.
42
+ You can search for a product ID indexed in the sample data you inserted/uploaded. And also you can specify the number to results to be returned.
43
+
43
44
 
44
45
  ```ruby
45
46
  sample_prod_id = 2761
46
- query_response = client.get_visual_recommendations(sample_prod_id)
47
+ num = 4
48
+ query_response = client.get_visual_recommendation(sample_prod_id, num)
47
49
  puts query_response
48
50
  ```
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'artifacia'
3
- s.version = '0.1'
3
+ s.version = '0.1.2'
4
4
  s.date = Date.today
5
5
  s.summary = "Artifacia!"
6
6
  s.description = "A ruby client to integrate visual recommendation feature from Artifacia API"
@@ -10,31 +10,35 @@ class Client
10
10
  @host = 'api.artifacia.com'
11
11
  end
12
12
 
13
- def upload_user_data(data)
14
- @post_ws = "/v1/users"
15
- @payload=data
13
+ def upload_user_purchased_items(user_id, data)
14
+ @post_ws = "/v1/users/#{user_id}/purchased_items"
15
+ req = Net::HTTP::Post.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
16
+ req.basic_auth @user, @pass
17
+ req.body = data
18
+ response = Net::HTTP.new(@host).start {|http| http.request(req) }
19
+ return response.body
20
+ end
16
21
 
22
+ def upload_user_viewed_items(user_id, data)
23
+ @post_ws = "/v1/users/#{user_id}/viewed_items"
17
24
  req = Net::HTTP::Post.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
18
25
  req.basic_auth @user, @pass
19
- req.body = @payload
26
+ req.body = data
20
27
  response = Net::HTTP.new(@host).start {|http| http.request(req) }
21
28
  return response.body
22
29
  end
23
30
 
24
31
  def upload_item_data(data)
25
32
  @post_ws = "/v1/items"
26
- @payload=data
27
-
28
33
  req = Net::HTTP::Post.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
29
34
  req.basic_auth @user, @pass
30
- req.body = @payload
35
+ req.body = data
31
36
  response = Net::HTTP.new(@host).start {|http| http.request(req) }
32
37
  return response.body
33
38
  end
34
39
 
35
40
  def delete_item_data(item_ids)
36
41
  @post_ws = "/v1/items"
37
-
38
42
  req = Net::HTTP::Delete.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
39
43
  req.basic_auth @user, @pass
40
44
  req.body = item_ids
@@ -42,24 +46,24 @@ class Client
42
46
  return response.body
43
47
  end
44
48
 
45
- def get_visual_recommendation(prod_id)
46
- @post_ws = "/v1/recommendation/similar/#{prod_id}"
49
+ def get_visual_recommendation(prod_id, num)
50
+ @post_ws = "/v1/recommendation/similar/#{prod_id}/#{num}"
47
51
  req = Net::HTTP::Get.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
48
52
  req.basic_auth @user, @pass
49
53
  response = Net::HTTP.new(@host).start {|http| http.request(req) }
50
54
  return response.body
51
55
  end
52
56
 
53
- def get_cpr_recommendation(prod_id)
54
- @post_ws = "/v1/recommendation/collections/#{prod_id}"
57
+ def get_cpr_recommendation(prod_id, num)
58
+ @post_ws = "/v1/recommendation/collections/#{prod_id}/#{num}"
55
59
  req = Net::HTTP::Get.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
56
60
  req.basic_auth @user, @pass
57
61
  response = Net::HTTP.new(@host).start {|http| http.request(req) }
58
62
  return response.body
59
63
  end
60
64
 
61
- def get_smart_recommendation(prod_id)
62
- @post_ws = "/v1/recommendation/user/#{prod_id}"
65
+ def get_personalized_recommendation(user_id, num)
66
+ @post_ws = "/v1/recommendation/user/#{user_id}/#{num}"
63
67
  req = Net::HTTP::Get.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
64
68
  req.basic_auth @user, @pass
65
69
  response = Net::HTTP.new(@host).start {|http| http.request(req) }
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'
4
+ version: 0.1.2
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-07-21 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A ruby client to integrate visual recommendation feature from Artifacia
14
14
  API
@@ -17,9 +17,9 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - lib/artifacia.rb
21
- - artifacia.gemspec
22
20
  - README.md
21
+ - artifacia.gemspec
22
+ - lib/artifacia.rb
23
23
  homepage: https://github.com/artifacia/artifacia-client-ruby
24
24
  licenses: []
25
25
  metadata: {}
@@ -29,17 +29,17 @@ require_paths:
29
29
  - lib
30
30
  required_ruby_version: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  required_rubygems_version: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  requirements: []
41
41
  rubyforge_project:
42
- rubygems_version: 2.0.14.1
42
+ rubygems_version: 2.5.1
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: Artifacia!