iubenda_api 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +59 -0
- data/Gemfile.lock +4 -1
- data/README.md +74 -6
- data/iubenda_api.gemspec +1 -0
- data/lib/iubenda_api.rb +4 -0
- data/lib/iubenda_api/consent_solution/clients/consent.rb +84 -0
- data/lib/iubenda_api/consent_solution/clients/legal_notice.rb +125 -0
- data/lib/iubenda_api/consent_solution/clients/subject.rb +18 -22
- data/lib/iubenda_api/consent_solution/consent.rb +92 -0
- data/lib/iubenda_api/consent_solution/legal_notice.rb +132 -0
- data/lib/iubenda_api/consent_solution/subject.rb +10 -19
- data/lib/iubenda_api/version.rb +1 -1
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3262f34a681a56f8ef4350ef46d3093b717eb36
|
4
|
+
data.tar.gz: 41bf966ca5ae22d079bdba31be6ed93fb0907e46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f9ae33498b112213220c748cd20d9924fca9ef1a6c2377755aab91eff08e6ce0939778e1037cc5ecb030754cb413772c965752dbd8a6dd547d110d310c86179
|
7
|
+
data.tar.gz: 58d80319245db982407cf8ebe1f7ff5a188e361f248ef0a8375a374856c88fa6bcc014f504dd2c5afc03ae6559c6a1c06ca9c4cf8bf5cb9ca0bd5d2e61083e96
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
11
|
+
|
12
|
+
# Specify service dependencies here if necessary
|
13
|
+
# CircleCI maintains a library of pre-built images
|
14
|
+
# documented at https://circleci.com/docs/2.0/circleci-images/
|
15
|
+
# - image: circleci/postgres:9.4
|
16
|
+
|
17
|
+
working_directory: ~/repo
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- checkout
|
21
|
+
|
22
|
+
# Download and cache dependencies
|
23
|
+
- restore_cache:
|
24
|
+
keys:
|
25
|
+
- v1-dependencies-{{ checksum "iubenda_api.gemspec" }}
|
26
|
+
# fallback to using the latest cache if no exact match is found
|
27
|
+
- v1-dependencies-
|
28
|
+
|
29
|
+
- run:
|
30
|
+
name: install dependencies
|
31
|
+
command: |
|
32
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
33
|
+
|
34
|
+
- save_cache:
|
35
|
+
paths:
|
36
|
+
- ./vendor/bundle
|
37
|
+
key: v1-dependencies-{{ checksum "iubenda_api.gemspec" }}
|
38
|
+
|
39
|
+
# run tests!
|
40
|
+
- run:
|
41
|
+
name: run tests
|
42
|
+
command: |
|
43
|
+
mkdir /tmp/test-results
|
44
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
|
45
|
+
circleci tests split --split-by=timings)"
|
46
|
+
|
47
|
+
bundle exec rspec \
|
48
|
+
--format progress \
|
49
|
+
--format RspecJunitFormatter \
|
50
|
+
--out /tmp/test-results/rspec.xml \
|
51
|
+
--format progress \
|
52
|
+
$TEST_FILES
|
53
|
+
|
54
|
+
# collect reports
|
55
|
+
- store_test_results:
|
56
|
+
path: /tmp/test-results
|
57
|
+
- store_artifacts:
|
58
|
+
path: /tmp/test-results
|
59
|
+
destination: test-results
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
iubenda_api (1.0.
|
4
|
+
iubenda_api (1.0.1)
|
5
5
|
api_struct
|
6
6
|
dry-configurable
|
7
7
|
|
@@ -65,6 +65,8 @@ GEM
|
|
65
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
66
66
|
rspec-support (~> 3.9.0)
|
67
67
|
rspec-support (3.9.0)
|
68
|
+
rspec_junit_formatter (0.4.1)
|
69
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
68
70
|
safe_yaml (1.0.5)
|
69
71
|
unf (0.1.4)
|
70
72
|
unf_ext
|
@@ -83,6 +85,7 @@ DEPENDENCIES
|
|
83
85
|
iubenda_api!
|
84
86
|
rake (~> 10.0)
|
85
87
|
rspec (~> 3.0)
|
88
|
+
rspec_junit_formatter (~> 0.4.1)
|
86
89
|
webmock (~> 3.7.6)
|
87
90
|
|
88
91
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
This ruby client is an unofficial client
|
4
4
|
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/iubenda_api.svg)](https://badge.fury.io/rb/iubenda_api) [![Maintainability](https://api.codeclimate.com/v1/badges/4dbfa40f66bcac425417/maintainability)](https://codeclimate.com/github/raihan2006i/iubenda_api/maintainability) [![CircleCI](https://circleci.com/gh/raihan2006i/iubenda_api.svg?style=svg)](https://circleci.com/gh/raihan2006i/iubenda_api)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -23,10 +25,10 @@ Or install it yourself as:
|
|
23
25
|
This gem expects that you have already set `IUBENDA_API_KEY` environment variable. Use your Iubenda `Private key`
|
24
26
|
|
25
27
|
```ruby
|
26
|
-
|
27
|
-
|
28
|
+
# Subject
|
29
|
+
subject_id = 'testsubject'
|
28
30
|
IubendaApi::ConsentSolution::Subject.create(
|
29
|
-
id:
|
31
|
+
id: subject_id,
|
30
32
|
email: "john.doe@example.com",
|
31
33
|
first_name: "John",
|
32
34
|
last_name: "Doe",
|
@@ -37,6 +39,75 @@ IubendaApi::ConsentSolution::Subject.create(
|
|
37
39
|
IubendaApi::ConsentSolution::Subject.show(id) # -> #<IubendaApi::ConsentSolution::Subject email="john.doe@example.com" first_name="John" full_name=nil id="testsubject" last_name="Doe" owner_id="10240" preferences=nil timestamp="2019-11-05T11:33:20+00:00" verified=false>
|
38
40
|
IubendaApi::ConsentSolution::Subject.list # -> [#<IubendaApi::ConsentSolution::Subject email="john.doe@example.com" first_name="John" full_name=nil id="testsubject" last_name="Doe" owner_id="10240" preferences=nil timestamp="2019-11-05T11:33:20+00:00" verified=false>, ...]
|
39
41
|
IubendaApi::ConsentSolution::Subject.update(id, email: "john.snow@example.com", first_name: "John", last_name: "Snow", full_name: 'John Snow') # -> #<IubendaApi::ConsentSolution::Subject id="testsubject" timestamp="2019-11-05T11:33:20.039Z">
|
42
|
+
|
43
|
+
# Consent
|
44
|
+
IubendaApi::ConsentSolution::Consent.create(
|
45
|
+
subject: {
|
46
|
+
id: 'testsubject',
|
47
|
+
email: 'subject@example.com',
|
48
|
+
first_name: "John",
|
49
|
+
last_name: "Doe",
|
50
|
+
verified: false
|
51
|
+
},
|
52
|
+
preferences: {
|
53
|
+
newsletter: false,
|
54
|
+
privacy_policy: true
|
55
|
+
}
|
56
|
+
) # -> #<IubendaApi::ConsentSolution::Consent id="00b654b3-ce4d-45c9-a8aa-9450551579c0" timestamp="2019-11-05T11:33:20.039Z">
|
57
|
+
|
58
|
+
IubendaApi::ConsentSolution::Consent.show('00b654b3-ce4d-45c9-a8aa-9450551579c0') # -> #<IubendaApi::ConsentSolution::Consent id="00b654b3-ce4d-45c9-a8aa-9450551579c0", ...>
|
59
|
+
IubendaApi::ConsentSolution::Consent.list(limit: 1) # -> [#<IubendaApi::ConsentSolution::Consent id="00b654b3-ce4d-45c9-a8aa-9450551579c0", ...>, ...]
|
60
|
+
|
61
|
+
# Legal Notice
|
62
|
+
# Single legal notice without multi-language content:
|
63
|
+
IubendaApi::ConsentSolution::LegalNotice.create(
|
64
|
+
identifier: "privacy_policy",
|
65
|
+
content: "privacy policy content"
|
66
|
+
) # -> #<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-12-13T14:56:00Z">
|
67
|
+
|
68
|
+
# Single legal notice with multi-language content:
|
69
|
+
IubendaApi::ConsentSolution::LegalNotice.create(
|
70
|
+
identifier: "privacy_policy",
|
71
|
+
content: {
|
72
|
+
en: "privacy policy content",
|
73
|
+
it: "contenuto della privacy policy"
|
74
|
+
}
|
75
|
+
) # -> #<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-12-13T14:56:00Z">
|
76
|
+
|
77
|
+
# Multiple legal notice without multi-language content:
|
78
|
+
IubendaApi::ConsentSolution::LegalNotice.create_multiple([
|
79
|
+
{
|
80
|
+
identifier: "privacy_policy",
|
81
|
+
content: "privacy policy content"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
identifier: "cookie_policy",
|
85
|
+
content: "cookie policy content"
|
86
|
+
}
|
87
|
+
]) # -> [#<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-12-13T14:56:00Z">, #<IubendaApi::ConsentSolution::LegalNotice identifier="cookie_policy" version=1 timestamp="2019-12-13T14:56:00Z">]
|
88
|
+
|
89
|
+
# Multiple legal notice with multi-language content:
|
90
|
+
IubendaApi::ConsentSolution::LegalNotice.create_multiple([
|
91
|
+
{
|
92
|
+
identifier: "privacy_policy",
|
93
|
+
content: {
|
94
|
+
en: "privacy policy content",
|
95
|
+
it: "contenuto della privacy policy"
|
96
|
+
}
|
97
|
+
},
|
98
|
+
{
|
99
|
+
identifier: "cookie_policy",
|
100
|
+
content: {
|
101
|
+
en: "cookie policy content",
|
102
|
+
it: "contenuto della cookie policy"
|
103
|
+
}
|
104
|
+
},
|
105
|
+
]) # -> [#<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-12-13T14:56:00Z">, #<IubendaApi::ConsentSolution::LegalNotice identifier="cookie_policy" version=1 timestamp="2019-12-13T14:56:00Z">]
|
106
|
+
|
107
|
+
IubendaApi::ConsentSolution::LegalNotice.versions('privacy_policy') # -> [#<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-11-07T16:18:05+00:00" content=#<Hashie::Mash>, ...]
|
108
|
+
IubendaApi::ConsentSolution::LegalNotice.version('privacy_policy', 1) # -> #<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-11-07T16:18:05+00:00" content=#<Hashie::Mash>
|
109
|
+
IubendaApi::ConsentSolution::LegalNotice.list(limit: 1) # -> [#<IubendaApi::ConsentSolution::LegalNotice content=#<Hashie::Mash it="https://example.com/privacy_policy.pdf"> id="10298_privacy_policy" identifier="privacy_policy" owner_id="1000" timestamp="2019-11-22T14:12:06+00:00" version=1>, ...]
|
110
|
+
|
40
111
|
```
|
41
112
|
|
42
113
|
## Development
|
@@ -45,9 +116,6 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
45
116
|
|
46
117
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
47
118
|
|
48
|
-
TODO:
|
49
|
-
* Implement `IubendaApi::ConsentSolution::Consent` entity
|
50
|
-
* Implement `IubendaApi::ConsentSolution::LegalNotice` entity
|
51
119
|
|
52
120
|
## Contributing
|
53
121
|
|
data/iubenda_api.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.16"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
|
28
29
|
spec.add_development_dependency "webmock", "~> 3.7.6"
|
29
30
|
spec.add_development_dependency "dotenv", "~> 2.7.5"
|
30
31
|
end
|
data/lib/iubenda_api.rb
CHANGED
@@ -4,7 +4,11 @@ require 'dry-configurable'
|
|
4
4
|
require "iubenda_api/version"
|
5
5
|
require 'iubenda_api/settings'
|
6
6
|
require 'iubenda_api/consent_solution/clients/subject'
|
7
|
+
require 'iubenda_api/consent_solution/clients/consent'
|
8
|
+
require 'iubenda_api/consent_solution/clients/legal_notice'
|
7
9
|
require 'iubenda_api/consent_solution/subject'
|
10
|
+
require 'iubenda_api/consent_solution/consent'
|
11
|
+
require 'iubenda_api/consent_solution/legal_notice'
|
8
12
|
|
9
13
|
module IubendaApi # :nodoc:
|
10
14
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module IubendaApi # :nodoc:
|
2
|
+
module ConsentSolution # :nodoc:
|
3
|
+
module Clients # :nodoc:
|
4
|
+
|
5
|
+
# Endpoint wrapper class for Iubenda Consent HTTP APIs
|
6
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#consent-1
|
7
|
+
class Consent < ApiStruct::Client
|
8
|
+
consent_solution_api :consent
|
9
|
+
|
10
|
+
# Calls GET /consent/:id
|
11
|
+
#
|
12
|
+
# @param id [String] the id of the consent
|
13
|
+
# @return [Dry::Monads::Result::Success] if success
|
14
|
+
# @return [Dry::Monads::Result::Failure] if failed
|
15
|
+
# @example
|
16
|
+
# IubendaApi::ConsentSolution::Clients::Consent.new.show('testsubject') # -> Dry::Monads::Result::Success({:id=>"testsubject", :email=>"subject@example.com", :first_name=>"John", :last_name=>"Doe", :verified=>false, :owner_id=>"1", :preferences=> {}, :timestamp=>"2019-11-04T17:30:58+00:00"})
|
17
|
+
# IubendaApi::ConsentSolution::Clients::Consent.new.show('notfound') # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007ff1544606c0 @status=#<HTTP::Response::Status 404 Not Found>, @body={:status=>"not_found"}>)
|
18
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#get-consent
|
19
|
+
def show(id)
|
20
|
+
get(id)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Calls GET /consent
|
24
|
+
#
|
25
|
+
# @overload list
|
26
|
+
# @overload list(options)
|
27
|
+
# @param [Hash] options options to send as query parameters.
|
28
|
+
# @option options [String] :from_time Filter by consents timestamp. Returns all consents from that time onward (inclusive). Valid formats: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (unix timestamp in seconds). Default null
|
29
|
+
# @option options [String] :to_time Filter by consents timestamp. Returns all consents from that time backward (inclusive). Valid formats: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (unix timestamp in seconds). Default null
|
30
|
+
# @option options [String] :source Filter by consents source. Possible values: public, private. Default null
|
31
|
+
# @option options [String] :ip_address Filter by IP address. Default null. Valid formats (IP address format|’none’)
|
32
|
+
# @option options [String] :subject_id Filter by Subject ID. Default null
|
33
|
+
# @option options [String] :subject_email_exact Filter by Subject email. It must exactly match (case sensitive). Default null
|
34
|
+
# @option options [String] :subject_email Filter by Subject email. It tries to match parts of the provided email split by dots and spaces. Ex. providing “@test.com” will match all the subjects with an email containing “@test” or containing “com” (case insensitive). Default null
|
35
|
+
# @option options [String] :subject_first_name Filter by Subject first name. It must exactly match (case sensitive). Default null
|
36
|
+
# @option options [String] :subject_last_name Filter by Subject last name. It must exactly match (case sensitive). Default null
|
37
|
+
# @option options [String] :subject_full_name Filter by Subject full name. It tries to match parts of the provided full name split by dots and spaces. Ex. “test hello” will match all the subjects with a full name containing “test” or containing “hello” (case insensitive). Default null
|
38
|
+
# @option options [String] :subject_verified Filter by subject verified status. Possible values: true, false. Default null
|
39
|
+
# @option options [String] :preference_key Filter for consents in which the key exists. Default null
|
40
|
+
# @option options [UUID] :starting_after Cursor which indicates after which Consent the results should be returned (cursor excluded). Default null
|
41
|
+
# @option options [Numeric] :limit optional Integer Number indicating the number of results returned. Min: 1, Max: 100. Default 10
|
42
|
+
# @return [Dry::Monads::Result::Success] if success
|
43
|
+
# @return [Dry::Monads::Result::Failure] if failed
|
44
|
+
# @example
|
45
|
+
# IubendaApi::ConsentSolution::Clients::Consent.new.list(limit: 1) # -> Dry::Monads::Result::Success([{:id=>"testsubject", :email=>"subject@example.com", :first_name=>"John", :last_name=>"Doe", :verified=>false, :owner_id=>"1", :preferences=> {}, :timestamp=>"2019-11-04T17:30:58+00:00"}])
|
46
|
+
# IubendaApi::ConsentSolution::Clients::Consent.new.list(limit: 1) # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007f7f699fc3c0 @status=#<HTTP::Response::Status 403 Forbidden>, @body={:message=>"Invalid authentication credentials"}>)
|
47
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#list-consents
|
48
|
+
def list(options = {})
|
49
|
+
get(params: options)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Calls POST /consent
|
53
|
+
#
|
54
|
+
# @param [Hash] options options to send as subject attributes.
|
55
|
+
# @option options [String] :timestamp ISO 8601 timestamp at which the consent occurred
|
56
|
+
# @option options [Hash] :subject
|
57
|
+
# * :id (String) auto-filled if not provided
|
58
|
+
# * :email (String)
|
59
|
+
# * :first_name (String)
|
60
|
+
# * :last_name (String)
|
61
|
+
# * :full_name (String)
|
62
|
+
# * :verified (Boolean) Reserved field used to signal whether a subject is verified, for instance via the double opt-in method
|
63
|
+
# @option options [Array<Hash>] :legal_notices Array of objects containing legal_notices data
|
64
|
+
# * :identifier (String) privacy_policy, cookie_policy, terms or a custom identifier
|
65
|
+
# * :version (String) auto-filled if not provided
|
66
|
+
# @option options [Array<Hash>] :proofs Array of objects containing proof data
|
67
|
+
# * :content (String)
|
68
|
+
# * :form (String)
|
69
|
+
# @option options [Hash] :preferences Set of key-value pairs with user preferences for the consent action
|
70
|
+
# @option options [String] :ip_address Considered only when using a `private` key. Saves the passed IP address on the Consent. Default null
|
71
|
+
# @option options [String] :autodetect_ip_address Default `true`, Considered only when using a `public` key. Enables or disables (true, false) the IP address autedetection. Default true
|
72
|
+
# @return [Dry::Monads::Result::Success] if success
|
73
|
+
# @return [Dry::Monads::Result::Failure] if failed
|
74
|
+
# @example
|
75
|
+
# IubendaApi::ConsentSolution::Clients::Consent.new.create(id: 'testsubject', email: 'subject@example.com', first_name: "John", last_name: "Doe", verified: false) # -> Dry::Monads::Result::Success({:id=>"testsubject", :timestamp=>"2019-11-05T11:33:20.039Z"})
|
76
|
+
# IubendaApi::ConsentSolution::Clients::Consent.new.create(id: 'testsubject', email: 'subject@example.com', first_name: "John", last_name: "Doe", verified: false) # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007f7f699fc3c0 @status=#<HTTP::Response::Status 403 Forbidden>, @body={:message=>"Invalid authentication credentials"}>)
|
77
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#create-consent
|
78
|
+
def create(options)
|
79
|
+
post(json: options)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
module IubendaApi # :nodoc:
|
2
|
+
module ConsentSolution # :nodoc:
|
3
|
+
module Clients # :nodoc:
|
4
|
+
|
5
|
+
# Endpoint wrapper class for Iubenda LegalNotice HTTP APIs
|
6
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#legal-notices
|
7
|
+
class LegalNotice < ApiStruct::Client
|
8
|
+
consent_solution_api :legal_notices
|
9
|
+
|
10
|
+
# Calls GET /legal_notices/:identifier/:version
|
11
|
+
#
|
12
|
+
# @param identifier [String] the identifier of the legal notice
|
13
|
+
# @param version [String] the version of the legal notice
|
14
|
+
# @return [Dry::Monads::Result::Success] if success
|
15
|
+
# @return [Dry::Monads::Result::Failure] if failed
|
16
|
+
# @example
|
17
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.version('privacy_policy', '1') # -> Dry::Monads::Result::Success({:identifier=>"privacy_policy", :version=>1, :timestamp=>"2019-11-07T15:26:33+00:00", :content=>{:it=>"http://localhost:3000/privacy_policy.pdf"}})
|
18
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.version('notfound', '1') # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007ff1544606c0 @status=#<HTTP::Response::Status 404 Not Found>, @body={:status=>"not_found"}>)
|
19
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#get-a-legal-notice-version
|
20
|
+
def version(identifier, version)
|
21
|
+
get(path: 'legal_notices/:identifier/:version', identifier: identifier, version: version)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Calls GET /legal_notices/:identifier
|
25
|
+
#
|
26
|
+
# @param identifier [String] the identifier of the legal notice
|
27
|
+
# @return [Dry::Monads::Result::Success] if success
|
28
|
+
# @return [Dry::Monads::Result::Failure] if failed
|
29
|
+
# @example
|
30
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.versions('privacy_policy') # -> Dry::Monads::Result::Success([{:identifier=>"privacy_policy", :version=>1, :timestamp=>"2019-11-07T15:26:33+00:00", :id=>"10298_privacy_policy", :owner_id=>"10298", :content=>{:it=>"http://localhost:3000/privacy_policy.pdf"}}])
|
31
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.versions('notfound') # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007ff1544606c0 @status=#<HTTP::Response::Status 404 Not Found>, @body={:status=>"not_found"}>)
|
32
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#get-all-legal-notice-versions
|
33
|
+
def versions(identifier)
|
34
|
+
get(path: 'legal_notices/:identifier', identifier: identifier)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Calls GET /legal_notices
|
38
|
+
#
|
39
|
+
# @overload list
|
40
|
+
# @overload list(options)
|
41
|
+
# @param [Hash] options options to send as query parameters.
|
42
|
+
# @option options [String] :id Optional, Filter by id. It must exactly match. Default null
|
43
|
+
# @option options [String] :identifier Optional, Filter by identifier. It must exactly match (case sensitive). Default null.
|
44
|
+
# @option options [Numeric] :version Optional, Numeric Filter by version. It must exactly match. Default null.
|
45
|
+
# @option options [String] :language Optional, Filter by legal notices which contents include the specified language (using short form like ‘en’, ‘it’ etc.). Default null.
|
46
|
+
# @option options [String] :from_time Optional, Filter by legal notices timestamp. Returns all legal notices from that time onward (inclusive). Valid formats: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (unix timestamp in seconds). Default null.
|
47
|
+
# @option options [String] :to_time Optional, Filter by legal notices timestamp. Returns all legal notices from that time backward (inclusive). Valid formats: 2018-02-22 00:40:00 UTC, 2018-02-22T00:40:00Z (ISO 8601), 1519260000 (unix timestamp in seconds). Default null.
|
48
|
+
# @option options [Numeric] :starting_after_version Optional, Cursor which indicates after which Legal Notice’s version the results should be returned (cursor excluded). Default null.
|
49
|
+
# @option options [String] :starting_after_identifier Optional, Cursor which indicates after which Legal Notice’s identifier the results should be returned (cursor excluded). Default null.
|
50
|
+
# @option options [Numeric] :limit Optional, Number indicating the number of results returned. Min: 1, Max: 100. Default 10.
|
51
|
+
# @return [Dry::Monads::Result::Success] if success
|
52
|
+
# @return [Dry::Monads::Result::Failure] if failed
|
53
|
+
# @example
|
54
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.list(limit: 1) # -> Dry::Monads::Result::Success([{:identifier=>"privacy_policy", :version=>1, :timestamp=>"2019-11-07T15:26:33+00:00", :id=>"10298_privacy_policy", :owner_id=>"10298", :content=>{:it=>"http://localhost:3000/privacy_policy.pdf"}}])
|
55
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.list(limit: 1) # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007f7f699fc3c0 @status=#<HTTP::Response::Status 403 Forbidden>, @body={:message=>"Invalid authentication credentials"}>)
|
56
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#list-legal-notices
|
57
|
+
def list(options = {})
|
58
|
+
get(params: options)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Calls POST /legal_notices
|
62
|
+
#
|
63
|
+
# @param [Hash] options options to send as legal notice attributes.
|
64
|
+
# @option options [String] :identifier Identifier of the legal notice
|
65
|
+
# @option options [String] :timestamp ISO 8601 timestamp at operation
|
66
|
+
# @option options [String, Hash] :content Content of the legal notice
|
67
|
+
# @return [Dry::Monads::Result::Success] if success
|
68
|
+
# @return [Dry::Monads::Result::Failure] if failed
|
69
|
+
# @example
|
70
|
+
# # Without multi-language content:
|
71
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.create(
|
72
|
+
# identifier: "privacy_policy",
|
73
|
+
# content: "privacy policy content"
|
74
|
+
# ) # -> Dry::Monads::Result::Success({:identifier=>"privacy_policy", :version=>1, :timestamp=>"2018-05-16T13:55:57"})
|
75
|
+
#
|
76
|
+
# # With multi-language content:
|
77
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.create(
|
78
|
+
# identifier: "privacy_policy",
|
79
|
+
# content: {
|
80
|
+
# en: "privacy policy content",
|
81
|
+
# it: "contenuto della privacy policy"
|
82
|
+
# }
|
83
|
+
# ) # -> Dry::Monads::Result::Success({:identifier=>"privacy_policy", :version=>1, :timestamp=>"2018-05-16T13:55:57"})
|
84
|
+
#
|
85
|
+
# # Error
|
86
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.create(identifier: 'privacy_policy', content: 'privacy policy content') # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007f7f699fc3c0 @status=#<HTTP::Response::Status 403 Forbidden>, @body={:message=>"Invalid authentication credentials"}>)
|
87
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#create-a-legal-notice
|
88
|
+
def create(options)
|
89
|
+
post(json: options)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Calls POST /legal_notices
|
93
|
+
#
|
94
|
+
# @param [Array<Hash>] options Array of legal notice attributes
|
95
|
+
# * :identifier (String) Identifier of the legal notice
|
96
|
+
# * :timestamp (String) ISO 8601 timestamp at operation
|
97
|
+
# * :content (String, Hash) Content of the legal notice
|
98
|
+
# @return [Dry::Monads::Result::Success] if success
|
99
|
+
# @return [Dry::Monads::Result::Failure] if failed
|
100
|
+
# @example
|
101
|
+
# # Without multi-language content:
|
102
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.create_multiple([
|
103
|
+
# identifier: "privacy_policy",
|
104
|
+
# content: "privacy policy content"
|
105
|
+
# ]) # -> Dry::Monads::Result::Success([{:identifier=>"privacy_policy", :version=>1, :timestamp=>"2018-05-16T13:55:57"}])
|
106
|
+
#
|
107
|
+
# # With multi-language content:
|
108
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.create_multiple([
|
109
|
+
# identifier: "privacy_policy",
|
110
|
+
# content: {
|
111
|
+
# en: "privacy policy content",
|
112
|
+
# it: "contenuto della privacy policy"
|
113
|
+
# }
|
114
|
+
# ]) # -> Dry::Monads::Result::Success([{:identifier=>"privacy_policy", :version=>1, :timestamp=>"2018-05-16T13:55:57"}])
|
115
|
+
#
|
116
|
+
# # Error
|
117
|
+
# IubendaApi::ConsentSolution::Clients::LegalNotice.new.create_multiple([identifier: 'privacy_policy', content: 'privacy policy content']) # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007f7f699fc3c0 @status=#<HTTP::Response::Status 403 Forbidden>, @body={:message=>"Invalid authentication credentials"}>)
|
118
|
+
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#create-multiple-legal-notices
|
119
|
+
def create_multiple(options)
|
120
|
+
post(json: options)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -2,7 +2,7 @@ module IubendaApi # :nodoc:
|
|
2
2
|
module ConsentSolution # :nodoc:
|
3
3
|
module Clients # :nodoc:
|
4
4
|
|
5
|
-
# Endpoint wrapper class for Iubenda
|
5
|
+
# Endpoint wrapper class for Iubenda Subject HTTP APIs
|
6
6
|
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#subjects-1
|
7
7
|
class Subject < ApiStruct::Client
|
8
8
|
consent_solution_api :subjects
|
@@ -13,8 +13,8 @@ module IubendaApi # :nodoc:
|
|
13
13
|
# @return [Dry::Monads::Result::Success] if success
|
14
14
|
# @return [Dry::Monads::Result::Failure] if failed
|
15
15
|
# @example
|
16
|
-
# IubendaApi::ConsentSolution::Clients::Subject.new.
|
17
|
-
# IubendaApi::ConsentSolution::Clients::Subject.new.
|
16
|
+
# IubendaApi::ConsentSolution::Clients::Subject.new.show('testsubject') # -> Dry::Monads::Result::Success({:id=>"testsubject", :email=>"subject@example.com", :first_name=>"John", :last_name=>"Doe", :verified=>false, :owner_id=>"1", :preferences=> {}, :timestamp=>"2019-11-04T17:30:58+00:00"})
|
17
|
+
# IubendaApi::ConsentSolution::Clients::Subject.new.show('notfound') # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007ff1544606c0 @status=#<HTTP::Response::Status 404 Not Found>, @body={:status=>"not_found"}>)
|
18
18
|
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#get-subjects
|
19
19
|
def show(id)
|
20
20
|
get(id)
|
@@ -49,42 +49,38 @@ module IubendaApi # :nodoc:
|
|
49
49
|
|
50
50
|
# Calls POST /subjects
|
51
51
|
#
|
52
|
-
# @
|
53
|
-
# @
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
# @option options [String] :full_name Optional
|
60
|
-
# @option options [Boolean] :verified Optional, Reserved field used to signal whether a subject is verified, for instance via the double opt-in method
|
52
|
+
# @param [Hash] options options to send as subject attributes.
|
53
|
+
# @option options [String] :id auto-filled if not provided
|
54
|
+
# @option options [String] :email Optional
|
55
|
+
# @option options [String] :first_name Optional
|
56
|
+
# @option options [String] :last_name Optional
|
57
|
+
# @option options [String] :full_name Optional
|
58
|
+
# @option options [Boolean] :verified Optional, Reserved field used to signal whether a subject is verified, for instance via the double opt-in method
|
61
59
|
# @return [Dry::Monads::Result::Success] if success
|
62
60
|
# @return [Dry::Monads::Result::Failure] if failed
|
63
61
|
# @example
|
64
62
|
# IubendaApi::ConsentSolution::Clients::Subject.new.create(id: 'testsubject', email: 'subject@example.com', first_name: "John", last_name: "Doe", verified: false) # -> Dry::Monads::Result::Success({:id=>"testsubject", :timestamp=>"2019-11-05T11:33:20.039Z"})
|
65
63
|
# IubendaApi::ConsentSolution::Clients::Subject.new.create(id: 'testsubject', email: 'subject@example.com', first_name: "John", last_name: "Doe", verified: false) # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007f7f699fc3c0 @status=#<HTTP::Response::Status 403 Forbidden>, @body={:message=>"Invalid authentication credentials"}>)
|
66
64
|
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#create-subjects
|
67
|
-
def create(options
|
65
|
+
def create(options)
|
68
66
|
post(json: options)
|
69
67
|
end
|
70
68
|
|
71
69
|
# Calls PUT /subjects/:id
|
72
70
|
#
|
73
|
-
# @
|
74
|
-
# @
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
# @option options [String] :full_name Optional
|
80
|
-
# @option options [Boolean] :verified Optional, Reserved field used to signal whether a subject is verified, for instance via the double opt-in method
|
71
|
+
# @param [Hash] options options to send as subject attributes.
|
72
|
+
# @option options [String] :email Optional
|
73
|
+
# @option options [String] :first_name Optional
|
74
|
+
# @option options [String] :last_name Optional
|
75
|
+
# @option options [String] :full_name Optional
|
76
|
+
# @option options [Boolean] :verified Optional, Reserved field used to signal whether a subject is verified, for instance via the double opt-in method
|
81
77
|
# @return [Dry::Monads::Result::Success] if success
|
82
78
|
# @return [Dry::Monads::Result::Failure] if failed
|
83
79
|
# @example
|
84
80
|
# IubendaApi::ConsentSolution::Clients::Subject.new.update('testsubject', email: 'john.doe@example.com') # -> Dry::Monads::Result::Success({:id=>"testsubject", :timestamp=>"2019-11-05T11:33:20.000+00:00"})
|
85
81
|
# IubendaApi::ConsentSolution::Clients::Subject.new.update('testsubject', email: 'john.doe@example.com') # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007f7f699fc3c0 @status=#<HTTP::Response::Status 403 Forbidden>, @body={:message=>"Invalid authentication credentials"}>)
|
86
82
|
# @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#update-subjects
|
87
|
-
def update(id, options
|
83
|
+
def update(id, options)
|
88
84
|
put(id, json: options)
|
89
85
|
end
|
90
86
|
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module IubendaApi # :nodoc:
|
2
|
+
module ConsentSolution # :nodoc:
|
3
|
+
|
4
|
+
# Response serializer class for client service IubendaApi::ConsentSolution::Clients::Consent
|
5
|
+
#
|
6
|
+
class Consent < ApiStruct::Entity
|
7
|
+
|
8
|
+
# @!method self.show(id)
|
9
|
+
# Gets a consent
|
10
|
+
# @param id [String] the id of the consent
|
11
|
+
# @return [IubendaApi::ConsentSolution::Consent] if found
|
12
|
+
# @return [ApiStruct::Errors::Entity] if not found or failed
|
13
|
+
# @example
|
14
|
+
# IubendaApi::ConsentSolution::Consent.show('00b654b3-ce4d-45c9-a8aa-9450551579c0') # -> #<IubendaApi::ConsentSolution::Consent id="00b654b3-ce4d-45c9-a8aa-9450551579c0", ...>
|
15
|
+
# IubendaApi::ConsentSolution::Consent.show('notfound') # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
16
|
+
# @see IubendaApi::ConsentSolution::Clients::Consent#show
|
17
|
+
#
|
18
|
+
#
|
19
|
+
|
20
|
+
# @!method self.list(options = {})
|
21
|
+
# Gets list of subjects
|
22
|
+
# @overload list
|
23
|
+
# @overload list(options)
|
24
|
+
# @param [Hash] options options to send as query parameters. Options are same as IubendaApi::ConsentSolution::Clients::Consent#list options
|
25
|
+
# @see IubendaApi::ConsentSolution::Clients::Consent#list
|
26
|
+
# @return [Array<IubendaApi::ConsentSolution::Consent>] if success
|
27
|
+
# @return [ApiStruct::Errors::Entity] if failed
|
28
|
+
# @example
|
29
|
+
# IubendaApi::ConsentSolution::Consent.list(limit: 1) # -> [#<IubendaApi::ConsentSolution::Consent id="00b654b3-ce4d-45c9-a8aa-9450551579c0", ...>, ...]
|
30
|
+
# IubendaApi::ConsentSolution::Consent.list(limit: 1) # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
31
|
+
#
|
32
|
+
|
33
|
+
# @!method self.create(options)
|
34
|
+
# Creates a consent
|
35
|
+
#
|
36
|
+
# @param [Hash] options options to send as consent attributes. Options are same as IubendaApi::ConsentSolution::Clients::Consent#create options
|
37
|
+
# @see IubendaApi::ConsentSolution::Clients::Consent#create
|
38
|
+
# @return [IubendaApi::ConsentSolution::Consent] if created
|
39
|
+
# @return [ApiStruct::Errors::Entity] if not found or failed
|
40
|
+
# @example
|
41
|
+
# IubendaApi::ConsentSolution::Consent.create(
|
42
|
+
# subject: {
|
43
|
+
# id: 'testsubject',
|
44
|
+
# email: 'subject@example.com',
|
45
|
+
# first_name: "John",
|
46
|
+
# last_name: "Doe",
|
47
|
+
# verified: false
|
48
|
+
# },
|
49
|
+
# preferences: {
|
50
|
+
# newsletter: false,
|
51
|
+
# privacy_policy: true
|
52
|
+
# }
|
53
|
+
# ) # -> #<IubendaApi::ConsentSolution::Consent id="00b654b3-ce4d-45c9-a8aa-9450551579c0" timestamp="2019-11-05T11:33:20.039Z">
|
54
|
+
# IubendaApi::ConsentSolution::Consent.create({}) # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
55
|
+
#
|
56
|
+
#
|
57
|
+
client_service IubendaApi::ConsentSolution::Clients::Consent
|
58
|
+
|
59
|
+
# @!attribute [r] id
|
60
|
+
# @return [String] Unique identifier of the specific consent event
|
61
|
+
#
|
62
|
+
# @!attribute [r] timestamp
|
63
|
+
# @return [String] ISO 8601 timestamp at which the consent occurred
|
64
|
+
#
|
65
|
+
# @!attribute [r] checksum
|
66
|
+
# @return [String]
|
67
|
+
#
|
68
|
+
# @!attribute [r] owner
|
69
|
+
# @return [String] Unique identifier of the API key owner
|
70
|
+
#
|
71
|
+
# @!attribute [r] subject
|
72
|
+
# @return [Hash] Subject of the consent
|
73
|
+
#
|
74
|
+
# @!attribute [r] preferences
|
75
|
+
# @return [Hash] Set of key-value pairs with user preferences for the consent action
|
76
|
+
#
|
77
|
+
# @!attribute [r] legal_notices
|
78
|
+
# @return [Array<Hash>] Array of objects containing legal_notices data
|
79
|
+
#
|
80
|
+
# @!attribute [r] proofs
|
81
|
+
# @return [Array<Hash>] Array of objects containing proof data
|
82
|
+
#
|
83
|
+
# @!attribute [r] ip_address
|
84
|
+
# @return [String] IP address on the Consent
|
85
|
+
#
|
86
|
+
# @!attribute [r] source
|
87
|
+
# @return [String] Whether the consent was filed from the public or the private API key
|
88
|
+
#
|
89
|
+
attr_entity :id, :timestamp, :checksum, :owner, :subject, :preferences, :legal_notices, :proofs, :ip_address, :source
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
module IubendaApi # :nodoc:
|
2
|
+
module ConsentSolution # :nodoc:
|
3
|
+
|
4
|
+
# Response serializer class for client service IubendaApi::ConsentSolution::Clients::LegalNotice
|
5
|
+
#
|
6
|
+
class LegalNotice < ApiStruct::Entity
|
7
|
+
|
8
|
+
# @!method self.version(identifier, version)
|
9
|
+
# Gets a legal notice version
|
10
|
+
# @param identifier [String] the identifier of the legal notice
|
11
|
+
# @param version [String] the version of the legal notice
|
12
|
+
# @return [IubendaApi::ConsentSolution::LegalNotice] if found
|
13
|
+
# @return [ApiStruct::Errors::Entity] if not found or failed
|
14
|
+
# @example
|
15
|
+
# IubendaApi::ConsentSolution::LegalNotice.version('privacy_policy', 1) # -> #<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-11-07T16:18:05+00:00" content=#<Hashie::Mash>
|
16
|
+
# IubendaApi::ConsentSolution::LegalNotice.version('notfound', 1) # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
17
|
+
# @see IubendaApi::ConsentSolution::Clients::LegalNotice#version
|
18
|
+
#
|
19
|
+
|
20
|
+
# @!method self.versions(identifier)
|
21
|
+
# Gets list of versions of a legal notice
|
22
|
+
# @param identifier [String] the identifier of the legal notice
|
23
|
+
# @return [Array<IubendaApi::ConsentSolution::LegalNotice>] if success
|
24
|
+
# @return [ApiStruct::Errors::Entity] if failed
|
25
|
+
# @example
|
26
|
+
# IubendaApi::ConsentSolution::LegalNotice.versions('privacy_policy') # -> [#<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-11-07T16:18:05+00:00" content=#<Hashie::Mash>, ...]
|
27
|
+
# IubendaApi::ConsentSolution::LegalNotice.versions('notfound') # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
28
|
+
# @see IubendaApi::ConsentSolution::Clients::LegalNotice#versions
|
29
|
+
#
|
30
|
+
|
31
|
+
# @!method self.list(options = {})
|
32
|
+
# Gets list of legal notices
|
33
|
+
# @overload list
|
34
|
+
# @overload list(options)
|
35
|
+
# @param [Hash] options options to send as query parameters. Options are same as IubendaApi::ConsentSolution::Clients::LegalNotice#list options
|
36
|
+
# @see IubendaApi::ConsentSolution::Clients::LegalNotice#list
|
37
|
+
# @return [Array<IubendaApi::ConsentSolution::LegalNotice>] if success
|
38
|
+
# @return [ApiStruct::Errors::Entity] if failed
|
39
|
+
# @example
|
40
|
+
# IubendaApi::ConsentSolution::LegalNotice.list(limit: 1) # -> [#<IubendaApi::ConsentSolution::LegalNotice content=#<Hashie::Mash it="https://example.com/privacy_policy.pdf"> id="10298_privacy_policy" identifier="privacy_policy" owner_id="1000" timestamp="2019-11-22T14:12:06+00:00" version=1>, ...]
|
41
|
+
# IubendaApi::ConsentSolution::LegalNotice.list(limit: 1) # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
42
|
+
#
|
43
|
+
|
44
|
+
# @!method self.create(options)
|
45
|
+
# Creates a legal notice
|
46
|
+
# @param [Hash] options options to send as legal notice attributes. Options are same as IubendaApi::ConsentSolution::Clients::LegalNotice#create options
|
47
|
+
# @see IubendaApi::ConsentSolution::Clients::LegalNotice#create
|
48
|
+
# @return [IubendaApi::ConsentSolution::LegalNotice] if created
|
49
|
+
# @return [ApiStruct::Errors::Entity] if not created or failed
|
50
|
+
# @example
|
51
|
+
# # Without multi-language content:
|
52
|
+
# IubendaApi::ConsentSolution::LegalNotice.create(
|
53
|
+
# identifier: "privacy_policy",
|
54
|
+
# content: "privacy policy content"
|
55
|
+
# ) # -> #<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-12-13T14:56:00Z">
|
56
|
+
#
|
57
|
+
# # With multi-language content:
|
58
|
+
# IubendaApi::ConsentSolution::LegalNotice.create(
|
59
|
+
# identifier: "privacy_policy",
|
60
|
+
# content: {
|
61
|
+
# en: "privacy policy content",
|
62
|
+
# it: "contenuto della privacy policy"
|
63
|
+
# }
|
64
|
+
# ) # -> #<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-12-13T14:56:00Z">
|
65
|
+
#
|
66
|
+
# # Error
|
67
|
+
# IubendaApi::ConsentSolution::LegalNotice.create(identifier: "privacy_policy", content: "privacy policy content") # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
68
|
+
#
|
69
|
+
|
70
|
+
# @!method self.create_multiple(options)
|
71
|
+
# @param [Array<Hash>] options Array of legal notice attributes. Options are same as IubendaApi::ConsentSolution::Clients::LegalNotice#create_multiple options
|
72
|
+
# @see IubendaApi::ConsentSolution::Clients::LegalNotice#create_multiple
|
73
|
+
# @return [Array<IubendaApi::ConsentSolution::LegalNotice>] if success
|
74
|
+
# @return [ApiStruct::Errors::Entity] if not created or failed
|
75
|
+
# @example
|
76
|
+
# # Multiple legal notice without multi-language content:
|
77
|
+
# IubendaApi::ConsentSolution::LegalNotice.create_multiple([
|
78
|
+
# {
|
79
|
+
# identifier: "privacy_policy",
|
80
|
+
# content: "privacy policy content"
|
81
|
+
# },
|
82
|
+
# {
|
83
|
+
# identifier: "cookie_policy",
|
84
|
+
# content: "cookie policy content"
|
85
|
+
# }
|
86
|
+
# ]) # -> [#<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-12-13T14:56:00Z">, #<IubendaApi::ConsentSolution::LegalNotice identifier="cookie_policy" version=1 timestamp="2019-12-13T14:56:00Z">]
|
87
|
+
#
|
88
|
+
# # Multiple legal notice with multi-language content:
|
89
|
+
# IubendaApi::ConsentSolution::LegalNotice.create_multiple([
|
90
|
+
# {
|
91
|
+
# identifier: "privacy_policy",
|
92
|
+
# content: {
|
93
|
+
# en: "privacy policy content",
|
94
|
+
# it: "contenuto della privacy policy"
|
95
|
+
# }
|
96
|
+
# },
|
97
|
+
# {
|
98
|
+
# identifier: "cookie_policy",
|
99
|
+
# content: {
|
100
|
+
# en: "cookie policy content",
|
101
|
+
# it: "contenuto della cookie policy"
|
102
|
+
# }
|
103
|
+
# },
|
104
|
+
# ]) # -> [#<IubendaApi::ConsentSolution::LegalNotice identifier="privacy_policy" version=1 timestamp="2019-12-13T14:56:00Z">, #<IubendaApi::ConsentSolution::LegalNotice identifier="cookie_policy" version=1 timestamp="2019-12-13T14:56:00Z">]
|
105
|
+
#
|
106
|
+
# # Error
|
107
|
+
# IubendaApi::ConsentSolution::LegalNotice.create_multiple([identifier: 'privacy_policy', content: 'privacy policy content']) # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
108
|
+
#
|
109
|
+
client_service IubendaApi::ConsentSolution::Clients::LegalNotice
|
110
|
+
|
111
|
+
# @!attribute [r] id
|
112
|
+
# @return [String] ID of the legal notice
|
113
|
+
#
|
114
|
+
# @!attribute [r] identifier
|
115
|
+
# @return [String] The identifier of the legal notice
|
116
|
+
#
|
117
|
+
# @!attribute [r] version
|
118
|
+
# @return [Number] Version of the legal notice
|
119
|
+
#
|
120
|
+
# @!attribute [r] timestamp
|
121
|
+
# @return [String] ISO 8601 timestamp. Operation time, for instance creation time, update time
|
122
|
+
#
|
123
|
+
# @!attribute [r] content
|
124
|
+
# @return [String, Hash] Content of the legal notice. Returns hash when content is multi-language, otherwise returns string
|
125
|
+
#
|
126
|
+
# @!attribute [r] owner_id
|
127
|
+
# @return [String] owner id of the legal notice
|
128
|
+
#
|
129
|
+
attr_entity :id, :identifier, :version, :timestamp, :content, :owner_id
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -11,8 +11,8 @@ module IubendaApi # :nodoc:
|
|
11
11
|
# @return [IubendaApi::ConsentSolution::Subject] if found
|
12
12
|
# @return [ApiStruct::Errors::Entity] if not found or failed
|
13
13
|
# @example
|
14
|
-
# IubendaApi::ConsentSolution::Subject.
|
15
|
-
# IubendaApi::ConsentSolution::Subject.
|
14
|
+
# IubendaApi::ConsentSolution::Subject.show('testsubject') # -> #<IubendaApi::ConsentSolution::Subject email="john.doe@example.com" first_name="John" full_name=nil id="testsubject" last_name="Doe" owner_id="10240" preferences=nil timestamp="2019-11-05T11:33:20+00:00" verified=false>
|
15
|
+
# IubendaApi::ConsentSolution::Subject.show('notfound') # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
16
16
|
# @see IubendaApi::ConsentSolution::Clients::Subject#show
|
17
17
|
#
|
18
18
|
#
|
@@ -28,37 +28,28 @@ module IubendaApi # :nodoc:
|
|
28
28
|
# @example
|
29
29
|
# IubendaApi::ConsentSolution::Subject.list(limit: 1) # -> [#<IubendaApi::ConsentSolution::Subject email="john.doe@example.com" first_name="John" full_name=nil id="testsubject" last_name="Doe" owner_id="10240" preferences=nil timestamp="2019-11-05T11:33:20+00:00" verified=false>, ...]
|
30
30
|
# IubendaApi::ConsentSolution::Subject.list(limit: 1) # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
31
|
-
# @see IubendaApi::ConsentSolution::Clients::Subject#list(options)
|
32
31
|
#
|
33
32
|
|
34
|
-
# @!method self.create(options
|
33
|
+
# @!method self.create(options)
|
35
34
|
# Creates a subject
|
36
|
-
# @
|
37
|
-
# @
|
38
|
-
# @param [Hash] options options to send as subject attributes.
|
39
|
-
# @see IubendaApi::ConsentSolution::Clients::Subject#create Options are same as IubendaApi::ConsentSolution::Clients::Subject#create options
|
35
|
+
# @param [Hash] options options to send as subject attributes. Options are same as IubendaApi::ConsentSolution::Clients::Subject#create options
|
36
|
+
# @see IubendaApi::ConsentSolution::Clients::Subject#create
|
40
37
|
# @return [IubendaApi::ConsentSolution::Subject] if created
|
41
38
|
# @return [ApiStruct::Errors::Entity] if not found or failed
|
42
39
|
# @example
|
43
40
|
# IubendaApi::ConsentSolution::Subject.create(id: 'testsubject', email: 'subject@example.com', first_name: "John", last_name: "Doe", verified: false) # -> #<IubendaApi::ConsentSolution::Subject id="testsubject" timestamp="2019-11-05T11:33:20.039Z">
|
44
41
|
# IubendaApi::ConsentSolution::Subject.create(id: 'testsubject', email: 'subject@example.com', first_name: "John", last_name: "Doe", verified: false) # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
45
|
-
# @see IubendaApi::ConsentSolution::Clients::Subject#create
|
46
|
-
#
|
47
42
|
#
|
48
43
|
|
49
|
-
# @!method self.update(id, options
|
44
|
+
# @!method self.update(id, options)
|
50
45
|
# Updates a subject
|
51
|
-
# @
|
52
|
-
# @
|
53
|
-
# @param [Hash] options options to send as subject attributes.
|
54
|
-
# @see IubendaApi::ConsentSolution::Clients::Subject#update Options are same as IubendaApi::ConsentSolution::Clients::Subject#update options
|
46
|
+
# @param [Hash] options options to send as subject attributes. Options are same as IubendaApi::ConsentSolution::Clients::Subject#update options
|
47
|
+
# @see IubendaApi::ConsentSolution::Clients::Subject#update
|
55
48
|
# @return [IubendaApi::ConsentSolution::Subject] if updated
|
56
49
|
# @return [ApiStruct::Errors::Entity] if not found or failed
|
57
50
|
# @example
|
58
51
|
# IubendaApi::ConsentSolution::Subject.update('testsubject', email: 'subject@example.com') # -> #<IubendaApi::ConsentSolution::Subject id="testsubject" timestamp="2019-11-05T11:33:20.039Z">
|
59
52
|
# IubendaApi::ConsentSolution::Subject.update('testsubject', email: 'subject@example.com') # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
|
60
|
-
# @see IubendaApi::ConsentSolution::Clients::Subject#update
|
61
|
-
#
|
62
53
|
#
|
63
54
|
client_service IubendaApi::ConsentSolution::Clients::Subject
|
64
55
|
|
@@ -81,10 +72,10 @@ module IubendaApi # :nodoc:
|
|
81
72
|
# @return [Boolean] Reserved field used to signal whether a subject is verified, for instance via the double opt-in method
|
82
73
|
#
|
83
74
|
# @!attribute [r] preferences
|
84
|
-
# @return [
|
75
|
+
# @return [Hash] Set of key-value pairs with user preferences for the consent action
|
85
76
|
#
|
86
77
|
# @!attribute [r] timestamp
|
87
|
-
# @return [
|
78
|
+
# @return [String] ISO 8601 timestamp. Operation time, for instance creation time, update time
|
88
79
|
#
|
89
80
|
# @!attribute [r] owner_id
|
90
81
|
# @return [String] owner id of the subject
|
data/lib/iubenda_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iubenda_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raihan Mahmud Arman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: api_struct
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec_junit_formatter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.4.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.4.1
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: webmock
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +129,7 @@ executables: []
|
|
115
129
|
extensions: []
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
132
|
+
- ".circleci/config.yml"
|
118
133
|
- ".gitignore"
|
119
134
|
- ".rspec"
|
120
135
|
- ".travis.yml"
|
@@ -128,7 +143,11 @@ files:
|
|
128
143
|
- bin/setup
|
129
144
|
- iubenda_api.gemspec
|
130
145
|
- lib/iubenda_api.rb
|
146
|
+
- lib/iubenda_api/consent_solution/clients/consent.rb
|
147
|
+
- lib/iubenda_api/consent_solution/clients/legal_notice.rb
|
131
148
|
- lib/iubenda_api/consent_solution/clients/subject.rb
|
149
|
+
- lib/iubenda_api/consent_solution/consent.rb
|
150
|
+
- lib/iubenda_api/consent_solution/legal_notice.rb
|
132
151
|
- lib/iubenda_api/consent_solution/subject.rb
|
133
152
|
- lib/iubenda_api/settings.rb
|
134
153
|
- lib/iubenda_api/version.rb
|