boxx_loki 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +91 -0
- data/Rakefile +8 -0
- data/boxx_loki.gemspec +46 -0
- data/dist/boxx_loki-1.5.0.gem +0 -0
- data/dist/examples/get_recommendation.rb +0 -0
- data/docs/InlineResponse200.md +10 -0
- data/docs/InlineResponse400.md +9 -0
- data/docs/RecommendationApi.md +55 -0
- data/docs/RecommendationRequestData.md +14 -0
- data/docs/RecommendationRequestDataQuery.md +31 -0
- data/git_push.sh +55 -0
- data/lib/boxx_loki.rb +44 -0
- data/lib/boxx_loki/api/recommendation_api.rb +78 -0
- data/lib/boxx_loki/api_client.rb +388 -0
- data/lib/boxx_loki/api_error.rb +38 -0
- data/lib/boxx_loki/configuration.rb +202 -0
- data/lib/boxx_loki/models/inline_response_200.rb +206 -0
- data/lib/boxx_loki/models/inline_response_400.rb +197 -0
- data/lib/boxx_loki/models/recommendation_request_data.rb +262 -0
- data/lib/boxx_loki/models/recommendation_request_data_query.rb +520 -0
- data/lib/boxx_loki/version.rb +15 -0
- data/spec/api/recommendation_api_spec.rb +47 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/inline_response_200_spec.rb +54 -0
- data/spec/models/inline_response_400_spec.rb +48 -0
- data/spec/models/recommendation_request_data_query_spec.rb +180 -0
- data/spec/models/recommendation_request_data_spec.rb +78 -0
- data/spec/spec_helper.rb +111 -0
- metadata +261 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cdd9410bcce94de57864ce1a27dbaadf342c4641
|
4
|
+
data.tar.gz: 6c63d3cc9c3eb530171491d77f53b2e03cf4bbee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 05e32c97d003f840a68339dd314254930169b7f546f186d015400d1004ff5c10e07ef2548fe65c0fa48f12576286f084f0ebb27a3a0e563071355f0e1a4d72a2
|
7
|
+
data.tar.gz: ef527d8def2a04b0bbe32dd831af59d560a7d10caabe40206ad36d69566585ed2a5f2e2bb93a23af3de8dde9545e82a99b526c9b555c36b89def8d3bf17c3bfd
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# boxx_loki
|
2
|
+
|
3
|
+
BoxxLoki - the Ruby gem for the Recommendation API 2
|
4
|
+
|
5
|
+
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
6
|
+
|
7
|
+
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
|
+
|
9
|
+
- API version: 1.5.0
|
10
|
+
- Package version: 1.5.0
|
11
|
+
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
### Build a gem
|
16
|
+
|
17
|
+
To build the Ruby code into a gem:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
gem build boxx_loki.gemspec
|
21
|
+
```
|
22
|
+
|
23
|
+
Then either install the gem locally:
|
24
|
+
|
25
|
+
```shell
|
26
|
+
gem install ./boxx_loki-1.5.0.gem
|
27
|
+
```
|
28
|
+
(for development, run `gem install --dev ./boxx_loki-1.5.0.gem` to install the development dependencies)
|
29
|
+
|
30
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
|
+
|
32
|
+
Finally add this to the Gemfile:
|
33
|
+
|
34
|
+
gem 'boxx_loki', '~> 1.5.0'
|
35
|
+
|
36
|
+
### Install from Git
|
37
|
+
|
38
|
+
If the Ruby gem is hosted at a git repository: https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO, then add the following in the Gemfile:
|
39
|
+
|
40
|
+
gem 'boxx_loki', :git => 'https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO.git'
|
41
|
+
|
42
|
+
### Include the Ruby code directly
|
43
|
+
|
44
|
+
Include the Ruby code directly using `-I` as follows:
|
45
|
+
|
46
|
+
```shell
|
47
|
+
ruby -Ilib script.rb
|
48
|
+
```
|
49
|
+
|
50
|
+
## Getting Started
|
51
|
+
|
52
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
53
|
+
```ruby
|
54
|
+
# Load the gem
|
55
|
+
require 'boxx_loki'
|
56
|
+
|
57
|
+
api_instance = BoxxLoki::RecommendationApi.new
|
58
|
+
|
59
|
+
request_data = BoxxLoki::RecommendationRequestData.new # RecommendationRequestData | request data
|
60
|
+
|
61
|
+
|
62
|
+
begin
|
63
|
+
result = api_instance.root_post(request_data)
|
64
|
+
p result
|
65
|
+
rescue BoxxLoki::ApiError => e
|
66
|
+
puts "Exception when calling RecommendationApi->root_post: #{e}"
|
67
|
+
end
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
## Documentation for API Endpoints
|
72
|
+
|
73
|
+
All URIs are relative to *http://loki.boxx.ai*
|
74
|
+
|
75
|
+
Class | Method | HTTP request | Description
|
76
|
+
------------ | ------------- | ------------- | -------------
|
77
|
+
*BoxxLoki::RecommendationApi* | [**root_post**](docs/RecommendationApi.md#root_post) | **POST** / |
|
78
|
+
|
79
|
+
|
80
|
+
## Documentation for Models
|
81
|
+
|
82
|
+
- [BoxxLoki::InlineResponse200](docs/InlineResponse200.md)
|
83
|
+
- [BoxxLoki::InlineResponse400](docs/InlineResponse400.md)
|
84
|
+
- [BoxxLoki::RecommendationRequestData](docs/RecommendationRequestData.md)
|
85
|
+
- [BoxxLoki::RecommendationRequestDataQuery](docs/RecommendationRequestDataQuery.md)
|
86
|
+
|
87
|
+
|
88
|
+
## Documentation for Authorization
|
89
|
+
|
90
|
+
All endpoints do not require authorization.
|
91
|
+
|
data/Rakefile
ADDED
data/boxx_loki.gemspec
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
=begin
|
4
|
+
#Recommendation API 2
|
5
|
+
|
6
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
7
|
+
|
8
|
+
OpenAPI spec version: 1.5.0
|
9
|
+
|
10
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
+
Swagger Codegen version: 2.3.1
|
12
|
+
|
13
|
+
=end
|
14
|
+
|
15
|
+
$:.push File.expand_path("../lib", __FILE__)
|
16
|
+
require "boxx_loki/version"
|
17
|
+
|
18
|
+
Gem::Specification.new do |s|
|
19
|
+
s.name = "boxx_loki"
|
20
|
+
s.version = BoxxLoki::VERSION
|
21
|
+
s.platform = Gem::Platform::RUBY
|
22
|
+
s.authors = ["Rajat Mhetre"]
|
23
|
+
s.email = ["aida@boxx.ai"]
|
24
|
+
s.homepage = "https://github.com/swagger-api/swagger-codegen"
|
25
|
+
s.summary = "Recommendation API 2 Ruby Gem"
|
26
|
+
s.description = "Boxx.ai's recommendation sdk"
|
27
|
+
# TODO uncommnet and update below with a proper license
|
28
|
+
#s.license = "Apache 2.0"
|
29
|
+
s.required_ruby_version = ">= 1.9"
|
30
|
+
|
31
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
32
|
+
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
|
33
|
+
|
34
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
35
|
+
s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
|
36
|
+
s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
|
37
|
+
s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
|
38
|
+
s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
|
39
|
+
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
40
|
+
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
|
41
|
+
|
42
|
+
s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
|
43
|
+
s.test_files = `find spec/*`.split("\n")
|
44
|
+
s.executables = []
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
end
|
Binary file
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# BoxxLoki::InlineResponse200
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**error_status** | **BOOLEAN** | | [optional]
|
7
|
+
**result** | **Object** | | [optional]
|
8
|
+
**request** | **Object** | | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# BoxxLoki::RecommendationApi
|
2
|
+
|
3
|
+
All URIs are relative to *http://loki.boxx.ai*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**root_post**](RecommendationApi.md#root_post) | **POST** / |
|
8
|
+
|
9
|
+
|
10
|
+
# **root_post**
|
11
|
+
> InlineResponse200 root_post(request_data)
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
Get Recommendations
|
16
|
+
|
17
|
+
### Example
|
18
|
+
```ruby
|
19
|
+
# load the gem
|
20
|
+
require 'boxx_loki'
|
21
|
+
|
22
|
+
api_instance = BoxxLoki::RecommendationApi.new
|
23
|
+
|
24
|
+
request_data = BoxxLoki::RecommendationRequestData.new # RecommendationRequestData | request data
|
25
|
+
|
26
|
+
|
27
|
+
begin
|
28
|
+
result = api_instance.root_post(request_data)
|
29
|
+
p result
|
30
|
+
rescue BoxxLoki::ApiError => e
|
31
|
+
puts "Exception when calling RecommendationApi->root_post: #{e}"
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
### Parameters
|
36
|
+
|
37
|
+
Name | Type | Description | Notes
|
38
|
+
------------- | ------------- | ------------- | -------------
|
39
|
+
**request_data** | [**RecommendationRequestData**](RecommendationRequestData.md)| request data |
|
40
|
+
|
41
|
+
### Return type
|
42
|
+
|
43
|
+
[**InlineResponse200**](InlineResponse200.md)
|
44
|
+
|
45
|
+
### Authorization
|
46
|
+
|
47
|
+
No authorization required
|
48
|
+
|
49
|
+
### HTTP request headers
|
50
|
+
|
51
|
+
- **Content-Type**: application/json
|
52
|
+
- **Accept**: application/json
|
53
|
+
|
54
|
+
|
55
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# BoxxLoki::RecommendationRequestData
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**client_id** | **String** | |
|
7
|
+
**access_token** | **String** | |
|
8
|
+
**channel_id** | **String** | |
|
9
|
+
**widget_type** | **String** | | [optional]
|
10
|
+
**widget_instance** | **String** | | [optional]
|
11
|
+
**page_url** | **String** | | [optional]
|
12
|
+
**query** | [**RecommendationRequestDataQuery**](RecommendationRequestDataQuery.md) | |
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# BoxxLoki::RecommendationRequestDataQuery
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**userid** | **String** | | [optional]
|
7
|
+
**boxx_token_id** | **String** | | [optional]
|
8
|
+
**get_product_properties** | **BOOLEAN** | | [optional] [default to false]
|
9
|
+
**num** | **Integer** | | [optional]
|
10
|
+
**user_attribute_weight** | **Float** | | [optional]
|
11
|
+
**transaction_weight** | **Float** | | [optional]
|
12
|
+
**group_by_attribute** | **BOOLEAN** | | [optional]
|
13
|
+
**location** | **Array<Float>** | | [optional]
|
14
|
+
**radius** | **Integer** | | [optional]
|
15
|
+
**item_filters** | **Object** | | [optional]
|
16
|
+
**recent_actions** | **Object** | | [optional]
|
17
|
+
**repeat** | **BOOLEAN** | | [optional] [default to true]
|
18
|
+
**exclude** | **Array<String>** | | [optional]
|
19
|
+
**num_out_of** | **Float** | | [optional]
|
20
|
+
**offset** | **Float** | | [optional]
|
21
|
+
**random** | **Float** | | [optional]
|
22
|
+
**related_products** | **Array<String>** | | [optional]
|
23
|
+
**related_action_type** | **String** | | [optional]
|
24
|
+
**dont_repeat_transaction_types** | **Array<String>** | | [optional]
|
25
|
+
**product_ids** | **Array<String>** | | [optional]
|
26
|
+
**page_num** | **Float** | | [optional]
|
27
|
+
**maximize** | **String** | | [optional]
|
28
|
+
**latest_transactions** | **BOOLEAN** | | [optional] [default to false]
|
29
|
+
**ignore_filters** | **BOOLEAN** | | [optional] [default to false]
|
30
|
+
|
31
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
4
|
+
#
|
5
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
6
|
+
#
|
7
|
+
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
8
|
+
|
9
|
+
git_user_id=$1
|
10
|
+
git_repo_id=$2
|
11
|
+
release_note=$3
|
12
|
+
|
13
|
+
if [ "$git_user_id" = "" ]; then
|
14
|
+
git_user_id=""
|
15
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
16
|
+
fi
|
17
|
+
|
18
|
+
if [ "$git_repo_id" = "" ]; then
|
19
|
+
git_repo_id=""
|
20
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
21
|
+
fi
|
22
|
+
|
23
|
+
if [ "$release_note" = "" ]; then
|
24
|
+
release_note=""
|
25
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
26
|
+
fi
|
27
|
+
|
28
|
+
# Initialize the local directory as a Git repository
|
29
|
+
git init
|
30
|
+
|
31
|
+
# Adds the files in the local repository and stages them for commit.
|
32
|
+
git add .
|
33
|
+
|
34
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
35
|
+
git commit -m "$release_note"
|
36
|
+
|
37
|
+
# Sets the new remote
|
38
|
+
git_remote=`git remote`
|
39
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
40
|
+
|
41
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
42
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
43
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
44
|
+
else
|
45
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
46
|
+
fi
|
47
|
+
|
48
|
+
fi
|
49
|
+
|
50
|
+
git pull origin master
|
51
|
+
|
52
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
53
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
54
|
+
git push origin master 2>&1 | grep -v 'To https'
|
55
|
+
|
data/lib/boxx_loki.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
=begin
|
2
|
+
#Recommendation API 2
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.5.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'boxx_loki/api_client'
|
15
|
+
require 'boxx_loki/api_error'
|
16
|
+
require 'boxx_loki/version'
|
17
|
+
require 'boxx_loki/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'boxx_loki/models/inline_response_200'
|
21
|
+
require 'boxx_loki/models/inline_response_400'
|
22
|
+
require 'boxx_loki/models/recommendation_request_data'
|
23
|
+
require 'boxx_loki/models/recommendation_request_data_query'
|
24
|
+
|
25
|
+
# APIs
|
26
|
+
require 'boxx_loki/api/recommendation_api'
|
27
|
+
|
28
|
+
module BoxxLoki
|
29
|
+
class << self
|
30
|
+
# Customize default settings for the SDK using block.
|
31
|
+
# BoxxLoki.configure do |config|
|
32
|
+
# config.username = "xxx"
|
33
|
+
# config.password = "xxx"
|
34
|
+
# end
|
35
|
+
# If no block given, return the default Configuration object.
|
36
|
+
def configure
|
37
|
+
if block_given?
|
38
|
+
yield(Configuration.default)
|
39
|
+
else
|
40
|
+
Configuration.default
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
=begin
|
2
|
+
#Recommendation API 2
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.5.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require "uri"
|
14
|
+
|
15
|
+
module BoxxLoki
|
16
|
+
class RecommendationApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# Get Recommendations
|
25
|
+
# @param request_data request data
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [InlineResponse200]
|
28
|
+
def root_post(request_data, opts = {})
|
29
|
+
data, _status_code, _headers = root_post_with_http_info(request_data, opts)
|
30
|
+
return data
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Get Recommendations
|
35
|
+
# @param request_data request data
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers
|
38
|
+
def root_post_with_http_info(request_data, opts = {})
|
39
|
+
if @api_client.config.debugging
|
40
|
+
@api_client.config.logger.debug "Calling API: RecommendationApi.root_post ..."
|
41
|
+
end
|
42
|
+
# verify the required parameter 'request_data' is set
|
43
|
+
if @api_client.config.client_side_validation && request_data.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'request_data' when calling RecommendationApi.root_post"
|
45
|
+
end
|
46
|
+
# resource path
|
47
|
+
local_var_path = "/"
|
48
|
+
|
49
|
+
# query parameters
|
50
|
+
query_params = {}
|
51
|
+
|
52
|
+
# header parameters
|
53
|
+
header_params = {}
|
54
|
+
# HTTP header 'Accept' (if needed)
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
|
+
# HTTP header 'Content-Type'
|
57
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
58
|
+
|
59
|
+
# form parameters
|
60
|
+
form_params = {}
|
61
|
+
|
62
|
+
# http body (model)
|
63
|
+
post_body = @api_client.object_to_http_body(request_data)
|
64
|
+
auth_names = []
|
65
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
66
|
+
:header_params => header_params,
|
67
|
+
:query_params => query_params,
|
68
|
+
:form_params => form_params,
|
69
|
+
:body => post_body,
|
70
|
+
:auth_names => auth_names,
|
71
|
+
:return_type => 'InlineResponse200')
|
72
|
+
if @api_client.config.debugging
|
73
|
+
@api_client.config.logger.debug "API called: RecommendationApi#root_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
74
|
+
end
|
75
|
+
return data, status_code, headers
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|