iubenda_api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6607de3d8b26913af68de3012e23ffb397620f78
4
+ data.tar.gz: d9e0f9b85d4042755421722cf17230ecf9f56b3a
5
+ SHA512:
6
+ metadata.gz: 8e702d0cfc819c3f62f727668f3058ef1aec26d2ae57637f75c2ed1c3ab1e9d9108c1031cf99213ae35a1acb6774a1c485b286fc5b19d6136f6ac6cec14d8bf0
7
+ data.tar.gz: fd7c466105e9a35a845c2ad1b6bc6ec0d3cd7398815d0a85553174cc8c22400150c02eee3a04ecee59a223cdb102781e716f7e8bba2271e5de2e489a5259bbc1
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .DS_Store
10
+ .env
11
+ /.idea
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at raihan2006i@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in iubenda_api.gemspec
6
+ gemspec
@@ -0,0 +1,89 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ iubenda_api (1.0.0)
5
+ api_struct
6
+ dry-configurable
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ api_struct (1.0.5)
14
+ dry-configurable
15
+ dry-inflector
16
+ dry-monads (~> 1)
17
+ hashie
18
+ http
19
+ concurrent-ruby (1.1.5)
20
+ crack (0.4.3)
21
+ safe_yaml (~> 1.0.0)
22
+ diff-lcs (1.3)
23
+ domain_name (0.5.20190701)
24
+ unf (>= 0.0.5, < 1.0.0)
25
+ dotenv (2.7.5)
26
+ dry-configurable (0.8.3)
27
+ concurrent-ruby (~> 1.0)
28
+ dry-core (~> 0.4, >= 0.4.7)
29
+ dry-core (0.4.9)
30
+ concurrent-ruby (~> 1.0)
31
+ dry-equalizer (0.2.2)
32
+ dry-inflector (0.1.2)
33
+ dry-monads (1.2.0)
34
+ concurrent-ruby (~> 1.0)
35
+ dry-core (~> 0.4, >= 0.4.4)
36
+ dry-equalizer
37
+ ffi (1.11.1)
38
+ ffi-compiler (1.0.1)
39
+ ffi (>= 1.0.0)
40
+ rake
41
+ hashdiff (1.0.0)
42
+ hashie (4.0.0)
43
+ http (4.2.0)
44
+ addressable (~> 2.3)
45
+ http-cookie (~> 1.0)
46
+ http-form_data (~> 2.0)
47
+ http-parser (~> 1.2.0)
48
+ http-cookie (1.0.3)
49
+ domain_name (~> 0.5)
50
+ http-form_data (2.1.1)
51
+ http-parser (1.2.1)
52
+ ffi-compiler (>= 1.0, < 2.0)
53
+ public_suffix (4.0.1)
54
+ rake (10.5.0)
55
+ rspec (3.9.0)
56
+ rspec-core (~> 3.9.0)
57
+ rspec-expectations (~> 3.9.0)
58
+ rspec-mocks (~> 3.9.0)
59
+ rspec-core (3.9.0)
60
+ rspec-support (~> 3.9.0)
61
+ rspec-expectations (3.9.0)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.9.0)
64
+ rspec-mocks (3.9.0)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.9.0)
67
+ rspec-support (3.9.0)
68
+ safe_yaml (1.0.5)
69
+ unf (0.1.4)
70
+ unf_ext
71
+ unf_ext (0.0.7.6)
72
+ webmock (3.7.6)
73
+ addressable (>= 2.3.6)
74
+ crack (>= 0.3.2)
75
+ hashdiff (>= 0.4.0, < 2.0.0)
76
+
77
+ PLATFORMS
78
+ ruby
79
+
80
+ DEPENDENCIES
81
+ bundler (~> 1.16)
82
+ dotenv (~> 2.7.5)
83
+ iubenda_api!
84
+ rake (~> 10.0)
85
+ rspec (~> 3.0)
86
+ webmock (~> 3.7.6)
87
+
88
+ BUNDLED WITH
89
+ 1.16.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Raihan Mahmud Arman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # Ruby Client for Iubenda HTTP APIs
2
+
3
+ This ruby client is an unofficial client
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'iubenda_api'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install iubenda_api
20
+
21
+ ## Usage
22
+
23
+ This gem expects that you have already set `IUBENDA_API_KEY` environment variable. Use your Iubenda `Private key`
24
+
25
+ ```ruby
26
+ id = 'testsubject'
27
+
28
+ IubendaApi::ConsentSolution::Subject.create(
29
+ id: id,
30
+ email: "john.doe@example.com",
31
+ first_name: "John",
32
+ last_name: "Doe",
33
+ full_name: "John Doe",
34
+ verified: false
35
+ ) # -> #<IubendaApi::ConsentSolution::Subject id="testsubject" timestamp="2019-11-05T11:33:20.039Z">
36
+
37
+ 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
+ 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
+ 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">
40
+ ```
41
+
42
+ ## Development
43
+
44
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
+
46
+ 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
+
48
+ TODO:
49
+ * Implement `IubendaApi::ConsentSolution::Consent` entity
50
+ * Implement `IubendaApi::ConsentSolution::LegalNotice` entity
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/raihan2006i/iubenda_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
55
+
56
+ ## License
57
+
58
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
59
+
60
+ ## Code of Conduct
61
+
62
+ Everyone interacting in the IubendaApi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/iubenda_api/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require 'dotenv/load'
5
+ require "iubenda_api"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "iubenda_api/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "iubenda_api"
7
+ spec.version = IubendaApi::VERSION
8
+ spec.authors = ["Raihan Mahmud Arman"]
9
+ spec.email = ["raihan2006i@gmail.com"]
10
+
11
+ spec.summary = %q{Iubenda ruby client for HTTP API}
12
+ spec.homepage = "https://github.com/raihan2006i/iubenda_api"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'api_struct'
23
+ spec.add_dependency 'dry-configurable'
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.16"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rspec", "~> 3.0"
28
+ spec.add_development_dependency "webmock", "~> 3.7.6"
29
+ spec.add_development_dependency "dotenv", "~> 2.7.5"
30
+ end
@@ -0,0 +1,10 @@
1
+ require 'api_struct'
2
+ require 'dry-configurable'
3
+
4
+ require "iubenda_api/version"
5
+ require 'iubenda_api/settings'
6
+ require 'iubenda_api/consent_solution/clients/subject'
7
+ require 'iubenda_api/consent_solution/subject'
8
+
9
+ module IubendaApi # :nodoc:
10
+ end
@@ -0,0 +1,93 @@
1
+ module IubendaApi # :nodoc:
2
+ module ConsentSolution # :nodoc:
3
+ module Clients # :nodoc:
4
+
5
+ # Endpoint wrapper class for Iubenda Subjects HTTP APIs
6
+ # @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#subjects-1
7
+ class Subject < ApiStruct::Client
8
+ consent_solution_api :subjects
9
+
10
+ # Calls GET /subjects/:id
11
+ #
12
+ # @param id [String] the id of the subject
13
+ # @return [Dry::Monads::Result::Success] if success
14
+ # @return [Dry::Monads::Result::Failure] if failed
15
+ # @example
16
+ # IubendaApi::ConsentSolution::Clients::Subject.new.get('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.get('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-subjects
19
+ def show(id)
20
+ get(id)
21
+ end
22
+
23
+ # Calls GET /subjects
24
+ #
25
+ # @overload list
26
+ # @overload list(options)
27
+ # @param [Hash] options options to send as query parameters.
28
+ # @option options [String] :id Filter by id. It must exactly match. Default null
29
+ # @option options [String] :email_exact Filter by email. It must exactly match. (Case sensitive)
30
+ # @option options [String] :email Filter by 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).
31
+ # @option options [String] :first_name Filter by first name. It must exactly match (case sensitive).
32
+ # @option options [String] :last_name Filter by last name. It must exactly match (case sensitive).
33
+ # @option options [String] :full_name Filter by 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).
34
+ # @option options [String] :from_time Filter by subjects timestamp. Returns all subjects 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).
35
+ # @option options [String] :to_time Filter by subjects timestamp. Returns all subjects 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).
36
+ # @option options [Boolean] :verified Filter by verified status. Possible values: true, false.
37
+ # @option options [String] :fulltext Filters for results with the value provided being contained in either id, first_name, last_name, full_name, email.
38
+ # @option options [String] :starting_after Cursor which indicates after which Subject the results should be returned (cursor excluded).
39
+ # @option options [Numeric] :limit Number indicating the number of results returned. Min: 1, Max: 100.
40
+ # @return [Dry::Monads::Result::Success] if success
41
+ # @return [Dry::Monads::Result::Failure] if failed
42
+ # @example
43
+ # IubendaApi::ConsentSolution::Clients::Subject.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"}])
44
+ # IubendaApi::ConsentSolution::Clients::Subject.new.list(limit: 1) # -> Dry::Monads::Result::Failure(#<ApiStruct::Errors::Client:0x007f7f699fc3c0 @status=#<HTTP::Response::Status 403 Forbidden>, @body={:message=>"Invalid authentication credentials"}>)
45
+ # @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#list-subjects
46
+ def list(options = {})
47
+ get(params: options)
48
+ end
49
+
50
+ # Calls POST /subjects
51
+ #
52
+ # @overload create
53
+ # @overload create(options)
54
+ # @param [Hash] options options to send as subject attributes.
55
+ # @option options [String] :id auto-filled if not provided
56
+ # @option options [String] :email Optional
57
+ # @option options [String] :first_name Optional
58
+ # @option options [String] :last_name Optional
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
61
+ # @return [Dry::Monads::Result::Success] if success
62
+ # @return [Dry::Monads::Result::Failure] if failed
63
+ # @example
64
+ # 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
+ # 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
+ # @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#create-subjects
67
+ def create(options = {})
68
+ post(json: options)
69
+ end
70
+
71
+ # Calls PUT /subjects/:id
72
+ #
73
+ # @overload update(id)
74
+ # @overload update(id, options)
75
+ # @param [Hash] options options to send as subject attributes.
76
+ # @option options [String] :email Optional
77
+ # @option options [String] :first_name Optional
78
+ # @option options [String] :last_name Optional
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
81
+ # @return [Dry::Monads::Result::Success] if success
82
+ # @return [Dry::Monads::Result::Failure] if failed
83
+ # @example
84
+ # 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
+ # 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
+ # @see https://www.iubenda.com/en/help/6484-consent-solution-http-api-documentation#update-subjects
87
+ def update(id, options = {})
88
+ put(id, json: options)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,95 @@
1
+ module IubendaApi # :nodoc:
2
+ module ConsentSolution # :nodoc:
3
+
4
+ # Response serializer class for client service IubendaApi::ConsentSolution::Clients::Subject
5
+ #
6
+ class Subject < ApiStruct::Entity
7
+
8
+ # @!method self.show(id)
9
+ # Gets a subject
10
+ # @param id [String] the id of the subject
11
+ # @return [IubendaApi::ConsentSolution::Subject] if found
12
+ # @return [ApiStruct::Errors::Entity] if not found or failed
13
+ # @example
14
+ # IubendaApi::ConsentSolution::Subject.get('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.get('notfound') # -> #<ApiStruct::Errors::Entity body=#<Hashie::Mash message="Invalid authentication credentials"> error=true status=#<HTTP::Response::Status 403 Forbidden>>
16
+ # @see IubendaApi::ConsentSolution::Clients::Subject#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.
25
+ # @see IubendaApi::ConsentSolution::Clients::Subject#list Options are same as IubendaApi::ConsentSolution::Clients::Subject#list options
26
+ # @return [Array<IubendaApi::ConsentSolution::Subject>] if success
27
+ # @return [ApiStruct::Errors::Entity] if failed
28
+ # @example
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
+ # 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
+ #
33
+
34
+ # @!method self.create(options = {})
35
+ # Creates a subject
36
+ # @overload create
37
+ # @overload create(options)
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
40
+ # @return [IubendaApi::ConsentSolution::Subject] if created
41
+ # @return [ApiStruct::Errors::Entity] if not found or failed
42
+ # @example
43
+ # 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
+ # 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
+ #
48
+
49
+ # @!method self.update(id, options = {})
50
+ # Updates a subject
51
+ # @overload update(id)
52
+ # @overload update(id, options)
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
55
+ # @return [IubendaApi::ConsentSolution::Subject] if updated
56
+ # @return [ApiStruct::Errors::Entity] if not found or failed
57
+ # @example
58
+ # IubendaApi::ConsentSolution::Subject.update('testsubject', email: 'subject@example.com') # -> #<IubendaApi::ConsentSolution::Subject id="testsubject" timestamp="2019-11-05T11:33:20.039Z">
59
+ # 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
+ #
63
+ client_service IubendaApi::ConsentSolution::Clients::Subject
64
+
65
+ # @!attribute [r] id
66
+ # @return [String] ID of the subject
67
+ #
68
+ # @!attribute [r] email
69
+ # @return [String] Email of the subject
70
+ #
71
+ # @!attribute [r] first_name
72
+ # @return [String] First name of the subject
73
+ #
74
+ # @!attribute [r] last_name
75
+ # @return [String] Last name of the subject
76
+ #
77
+ # @!attribute [r] full_name
78
+ # @return [String] Full name of the subject
79
+ #
80
+ # @!attribute [r] verified
81
+ # @return [Boolean] Reserved field used to signal whether a subject is verified, for instance via the double opt-in method
82
+ #
83
+ # @!attribute [r] preferences
84
+ # @return [Object] Set of key-value pairs with user preferences for the consent action
85
+ #
86
+ # @!attribute [r] timestamp
87
+ # @return [Object] Operation time, for instance creation time, update time
88
+ #
89
+ # @!attribute [r] owner_id
90
+ # @return [String] owner id of the subject
91
+ #
92
+ attr_entity :id, :owner_id, :email, :first_name, :last_name, :full_name, :verified, :preferences, :timestamp
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,11 @@
1
+ ApiStruct::Settings.configure do |config| # :nodoc:
2
+ config.endpoints = {
3
+ consent_solution_api: {
4
+ root: 'https://consent.iubenda.com',
5
+ headers: {
6
+ 'ApiKey': ENV['IUBENDA_API_KEY'],
7
+ 'Content-Type': 'application/json'
8
+ }
9
+ }
10
+ }
11
+ end
@@ -0,0 +1,3 @@
1
+ module IubendaApi # :nodoc:
2
+ VERSION = "1.0.0" # :nodoc:
3
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iubenda_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Raihan Mahmud Arman
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: api_struct
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-configurable
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.7.6
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.7.6
97
+ - !ruby/object:Gem::Dependency
98
+ name: dotenv
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.7.5
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.7.5
111
+ description:
112
+ email:
113
+ - raihan2006i@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - CODE_OF_CONDUCT.md
122
+ - Gemfile
123
+ - Gemfile.lock
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - iubenda_api.gemspec
130
+ - lib/iubenda_api.rb
131
+ - lib/iubenda_api/consent_solution/clients/subject.rb
132
+ - lib/iubenda_api/consent_solution/subject.rb
133
+ - lib/iubenda_api/settings.rb
134
+ - lib/iubenda_api/version.rb
135
+ homepage: https://github.com/raihan2006i/iubenda_api
136
+ licenses:
137
+ - MIT
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project:
155
+ rubygems_version: 2.5.2
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: Iubenda ruby client for HTTP API
159
+ test_files: []