big_marker_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c1a6a622923e26061eda112840cf1945fdad94ec0f6762639e12734cad427aba
4
+ data.tar.gz: 138e902bd344d8db58402ba439981c6a93e0a2e570ef2412692e49dc6d67a016
5
+ SHA512:
6
+ metadata.gz: 51781618326aa7412c2ef978842394e6de4a83d093c5b18b85be4e0331d5c0c1a46c6c908f9d613732898c1416dd7cbadbaccb7d3f2f46db1e641c123620e449
7
+ data.tar.gz: 76bb29ba4b87ef94a2e68edf860c0d44c9795234b17a78006322d1ce35ff99e609f43d98b520b25e05765b74dcdc25d571228fe9fb1f23acff3991f5b492bb3f
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,42 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+ NewCops: enable
4
+ Exclude:
5
+ - "vendor/**/*"
6
+ - ".git/**/*"
7
+
8
+ require:
9
+ - rubocop-performance
10
+ - rubocop-rake
11
+ - rubocop-rspec
12
+
13
+ Layout/LineLength:
14
+ Max: 120
15
+
16
+ Metrics/BlockLength:
17
+ Exclude:
18
+ - "spec/**/*"
19
+ - "big_marker_client.gemspec"
20
+
21
+ Style/Documentation:
22
+ Enabled: false
23
+
24
+ Style/FrozenStringLiteralComment:
25
+ Enabled: false
26
+
27
+ Style/StringLiterals:
28
+ Enabled: true
29
+ EnforcedStyle: double_quotes
30
+
31
+ Style/StringLiteralsInInterpolation:
32
+ Enabled: true
33
+ EnforcedStyle: double_quotes
34
+
35
+ RSpec/ExampleLength:
36
+ Max: 10
37
+
38
+ RSpec/MessageSpies:
39
+ EnforcedStyle: receive
40
+
41
+ RSpec/MultipleExpectations:
42
+ Max: 5
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-12-10
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at bvk@capinside.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in bigmarker_client.gemspec
6
+ gemspec
7
+
8
+ gem "rake"
9
+
10
+ group :development do
11
+ gem "rubocop"
12
+ gem "rubocop-performance", require: false
13
+ gem "rubocop-rake", require: false
14
+ gem "rubocop-rspec", require: false
15
+ end
16
+
17
+ group :test do
18
+ gem "rspec", "~> 3.0"
19
+ gem "webmock"
20
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 CAPinside GmbH
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.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # BigMarkerClient
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bigmarker_client`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'big_marker_client'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install big_marker_client
22
+
23
+ ## Usage
24
+
25
+ As this is a lightweight wrapper around the BigMarker API, mostly refer to [their documentation](https://docs.bigmarker.com/). Most notably the creation of conferences will require a brief look into their requirements.
26
+
27
+ ## Development
28
+
29
+ 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.
30
+
31
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bigmarker_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/bigmarker_client/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the BigMarkerClient project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bigmarker_client/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "big_marker_client"
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__)
data/bin/setup ADDED
@@ -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,97 @@
1
+ module BigMarkerClient
2
+ module Api
3
+ module V1
4
+ class Conference
5
+ class Registration < ::BigMarkerClient::Base
6
+ LIST_REGISTRANTS = "/conferences/registrations/{id}".freeze
7
+ LIST_REGISTRANTS_WITH_FIELDS = "/conferences/registrations_with_fields/{id}".freeze
8
+ CREATE_REGISTRANT = "/conferences/register".freeze
9
+ DELETE_REGISTRANT = "/conferences/register".freeze
10
+ CHECK_REGISTRANT_STATUS = "/conferences/{id}/check_registration_status".freeze
11
+
12
+ class << self
13
+ ##
14
+ # list all registrants to a conference.
15
+ # @param conference_id [String] conference identifier
16
+ # @param params [Hash] recognized are:
17
+ # - page: pagination page
18
+ # - per_page: pagination page size (20*)
19
+ # @return [BigMarkerClient::Models::Registrant[]]
20
+ def list(conference_id, params = {})
21
+ result = get(replace_path_params(path: LIST_REGISTRANTS, replacements: { "{id}": conference_id }), params)
22
+ return map_to_model_array(result["registrations"]) if result["registrations"]
23
+
24
+ result
25
+ end
26
+
27
+ ##
28
+ # list all registrants to a conference with custom fields.
29
+ # @param conference_id [String] conference identifier
30
+ # @param params [Hash] recognized are:
31
+ # - page: pagination page
32
+ # - per_page: pagination page size (20*)
33
+ # @return [BigMarkerClient::Models::Registrant[]]
34
+ def list_with_fields(conference_id, params = {})
35
+ result = get(replace_path_params(path: LIST_REGISTRANTS_WITH_FIELDS,
36
+ replacements: { "{id}": conference_id }), params)
37
+ return map_to_model_array(result["registrations"]) if result["registrations"]
38
+
39
+ result
40
+ end
41
+
42
+ ##
43
+ # registers a participant to a conference.
44
+ # @param conference_id [String] conference identifier
45
+ # @param email [String] attendee email
46
+ # @param first_name [String] attendee first name
47
+ # @param last_name [String] attendee last name
48
+ # @param params [Hash] recognized are:
49
+ # - temporary_password: a temporary password for registrant
50
+ # - custom_fields: uRL encoded JSON object, keys are custom_field ids.
51
+ # - utm_bmcr_source: registrant’s UTM source code
52
+ # - custom_user_id: external custom user id
53
+ # @return [String] URL for the participant to enter the conference
54
+ def register(conference_id, email, first_name, last_name, params = {})
55
+ create_params = { id: conference_id, email: email, first_name: first_name, last_name: last_name }
56
+ .merge(params)
57
+ result = post(CREATE_REGISTRANT, create_params)
58
+ return result["conference_url"] if result["conference_url"]
59
+
60
+ result
61
+ end
62
+
63
+ ##
64
+ # remove a participant from a conference
65
+ # @param conference_id [String] conference identifier
66
+ # @param email [String] attendee email
67
+ def unregister(conference_id, email)
68
+ delete(DELETE_REGISTRANT, { id: conference_id, email: email })
69
+ end
70
+
71
+ ##
72
+ # check if a person is already registered to a conference. Recognized @params are
73
+ # @param conference_id [String] conference identifier
74
+ # @param params [Hash] recognized are:
75
+ # - bmid: a unique big_marker id of a attendee
76
+ # - email: the email of an attendee
77
+ # either of these two are required
78
+ # @return [String] status (registered. not registered)
79
+ def check_status(conference_id, params = {})
80
+ result = get(replace_path_params(path: CHECK_REGISTRANT_STATUS, replacements: { "{id}": conference_id }),
81
+ params)
82
+ return result["registration_status"] if result["registration_status"]
83
+
84
+ result
85
+ end
86
+
87
+ private
88
+
89
+ def map_to_model_array(hash_array)
90
+ hash_array.map { |hash| ::BigMarkerClient::Models::Registrant.new(hash) }
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,187 @@
1
+ module BigMarkerClient
2
+ module Api
3
+ module V1
4
+ class Conference < ::BigMarkerClient::Base
5
+ LIST_CONFERENCES = "/conferences".freeze
6
+ SEARCH_CONFERENCES = "/conferences/search".freeze
7
+ ASSOCIATED_SERIES_CONFERENCES = "/conferences/get_associated_sessions/{id}".freeze
8
+ RECURRING_CONFERENCES = "/conferences/recurring/{id}".freeze
9
+ CREATE_CONFERENCE = "/conferences".freeze
10
+ UPDATE_CONFERENCE = "/conferences/{id}".freeze
11
+ GET_CONFERENCE = "/conferences/{id}".freeze
12
+ GET_CONFERENCE_PRESENTERS = "/conferences/{id}/presenters".freeze
13
+ GET_CONFERENCE_ATTENDEES = "/conferences/{id}/attendees".freeze
14
+ DELETE_CONFERENCE = "/conferences/{id}".freeze
15
+ ENTER_CONFERENCE = "/conferences/enter".freeze
16
+
17
+ class << self
18
+ ##
19
+ # lists all conferences, where date range con only be influenced indirectly.
20
+ # @param params [Hash] recognized are:
21
+ # - role: Filter by member role (all*, hosting, attending)
22
+ # - type: Filter by conference type (future*, past, all, multiple_times, future_do_not_include_happening,
23
+ # future_with_24_hour_room, past_with_recording, always_open, happening_now)
24
+ # - query: search in conference title
25
+ # - page: pagination page
26
+ # - page_count: pagination page size (20*), ATTENTION: this is called per_page everywhere else!
27
+ # @return [BigMarkerClient::Models::Conference[]]
28
+ def list(params = {})
29
+ params["page_count"] ||= params["per_page"] if params["per_page"]
30
+ result = get(LIST_CONFERENCES, params)
31
+ return map_to_model_array(result["conferences"]) if result["conferences"]
32
+
33
+ result
34
+ end
35
+
36
+ ##
37
+ # search for conferences with specific matching criteria.
38
+ # @param params [Hash] recognized are:
39
+ # - title: search in conference title
40
+ # - start_time: conferences with start time after this date (Unix timestamp)
41
+ # - end_time: conferences with end time before this date (Unix timestamp)
42
+ # - conference_ids: select conferences based on their IDs (comma separated)
43
+ # - presenter_member_ids: select conferences based on their presenters IDs (comma separated)
44
+ # - role: Filter by member role (all*, hosting, attending)
45
+ # - type: Filter by conference type (evergreen_parent evergreen_child recurring_parent recurring_child
46
+ # meetingspace ondemand live_webinar webcast)
47
+ # - page: pagination page
48
+ # - per_page: pagination page size (20*)
49
+ # @return [BigMarkerClient::Models::Conference[]]
50
+ def search(params = {})
51
+ result = post(SEARCH_CONFERENCES, params)
52
+ return map_to_model_array(result["conferences"]) if result["conferences"]
53
+
54
+ result
55
+ end
56
+
57
+ ##
58
+ # get one conference based on it's ID
59
+ # @param conference_id [String] conference identifier
60
+ # @return [BigMarkerClient::Models::Conference]
61
+ def show(conference_id)
62
+ result = get(replace_path_params(path: GET_CONFERENCE, replacements: { "{id}": conference_id }))
63
+ return ::BigMarkerClient::Models::Conference.new(result["conference"]) if result["conference"]
64
+
65
+ result
66
+ end
67
+
68
+ ##
69
+ # get series related to a conference.
70
+ # @param conference_id [String] conference identifier
71
+ # @param params [Hash] recognized are:
72
+ # - page: pagination page
73
+ # - per_page: pagination page size (20*)
74
+ # @return [BigMarkerClient::Models::Conference[]]
75
+ def associated_series(conference_id, params = {})
76
+ result = get(replace_path_params(path: ASSOCIATED_SERIES_CONFERENCES,
77
+ replacements: { "{id}": conference_id }), params)
78
+ return map_to_model_array(result["conferences"]) if result["conferences"]
79
+
80
+ result
81
+ end
82
+
83
+ ##
84
+ # get child conferences of a parent recurring conference.
85
+ # @param conference_id [String] conference identifier
86
+ # @param params [Hash] recognized are:
87
+ # - start_time: conferences with start time after this date (Unix timestamp)
88
+ # - end_time: conferences with end time before this date (Unix timestamp)
89
+ # - page: pagination page
90
+ # - per_page: pagination page size (20*)
91
+ # @return [BigMarkerClient::Models::Conference[]]
92
+ def recurring(conference_id, params = {})
93
+ result = get(replace_path_params(path: RECURRING_CONFERENCES,
94
+ replacements: { "{id}": conference_id }), params)
95
+ return map_to_model_array(result["conferences"]) if result["conferences"]
96
+
97
+ result
98
+ end
99
+
100
+ ##
101
+ # update a conference either with a Models::Conference object or single properties as hash
102
+ # @param conference_id [String] conference identifier
103
+ # @param body [Hash or BigMarkerClient::Models::Conference]
104
+ # @return [BigMarkerClient::Models::Conference]
105
+ def update(conference_id, body = {})
106
+ body = body.to_h if body.is_a?(::BigMarkerClient::Models::Conference)
107
+ result = put(replace_path_params(path: UPDATE_CONFERENCE, replacements: { "{id}": conference_id }), body)
108
+ return ::BigMarkerClient::Models::Conference.new(result["conference"]) if result["conference"]
109
+
110
+ result
111
+ end
112
+
113
+ ##
114
+ # create a conference either with a Models::Conference object or single properties as hash
115
+ # @param body [Hash or BigMarkerClient::Models::Conference]
116
+ # @return [BigMarkerClient::Models::Conference]
117
+ def create(body = {})
118
+ body = body.to_h if body.is_a?(::BigMarkerClient::Models::Base)
119
+ result = post(CREATE_CONFERENCE, body)
120
+ return ::BigMarkerClient::Models::Conference.new(result["conference"]) if result["conference"]
121
+
122
+ result
123
+ end
124
+
125
+ ##
126
+ # delete a conference
127
+ # @param conference_id [String] conference identifier
128
+ def destroy(conference_id)
129
+ delete(replace_path_params(path: DELETE_CONFERENCE, replacements: { "{id}": conference_id }))
130
+ end
131
+
132
+ ##
133
+ # enter a conference towards an enterprise iframe,
134
+ # @param conference_id [String] conference identifier
135
+ # @param name [String] attendee name
136
+ # @param email [String] attendee email
137
+ # @param body [Hash] recognized are:
138
+ # - register_attendee_to_webinar: true/false*
139
+ # - attendee_first_name: First name of the attendee for registration (see register_attendee_to_webinar)
140
+ # - attendee_last_name: Last name of the attendee for registration (see register_attendee_to_webinar)
141
+ # - custom_user_id: an external user id for matching
142
+ # - role: the role of the user that is entering the webinar (attendee*, moderator, presenter)
143
+ # - exit_uri: URL that attendees will be redirected to after the webinar
144
+ # @return [Hash] enter_token: auth token for conference, enter_uri: URL to enter conference
145
+ def enter(conference_id, name, email, body = {})
146
+ body.merge!(id: conference_id, attendee_name: name, attendee_email: email)
147
+ post(ENTER_CONFERENCE, body)
148
+ end
149
+
150
+ ##
151
+ # Get all presenters of a conference.
152
+ # @param conference_id [String] conference identifier
153
+ # @return [BigMarkerClient::Models::Presenter[]]
154
+ def presenters(conference_id)
155
+ result = get(replace_path_params(path: GET_CONFERENCE_PRESENTERS, replacements: { "{id}": conference_id }))
156
+ if result["presenters"]
157
+ return map_to_model_array(result["presenters"], ::BigMarkerClient::Models::Presenter)
158
+ end
159
+
160
+ result
161
+ end
162
+
163
+ ##
164
+ # Get all registered attendees of a conference. Recognized @params are:
165
+ # @param conference_id [String] conference identifier
166
+ # @param params [Hash] recognized are:
167
+ # - page: pagination page
168
+ # - per_page: pagination page size (20*)
169
+ # @return [BigMarkerClient::Models::Attendee[]]
170
+ def attendees(conference_id, params = {})
171
+ result = get(replace_path_params(path: GET_CONFERENCE_ATTENDEES,
172
+ replacements: { "{id}": conference_id }), params)
173
+ return map_to_model_array(result["attendees"], ::BigMarkerClient::Models::Attendee) if result["attendees"]
174
+
175
+ result
176
+ end
177
+
178
+ private
179
+
180
+ def map_to_model_array(hash_array, model_class = ::BigMarkerClient::Models::Conference)
181
+ hash_array.map { |hash| model_class.new(hash) }
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
187
+ end
@@ -0,0 +1,63 @@
1
+ module BigMarkerClient
2
+ module Api
3
+ module V1
4
+ class Presenter < ::BigMarkerClient::Base
5
+ LIST_PRESENTER_CONFERENCES = "/presenters/{id}/list_conferences".freeze
6
+ CREATE_PRESENTER = "/presenters".freeze
7
+ UPDATE_PRESENTER = "/presenters/{id}".freeze
8
+ DELETE_PRESENTER = "/presenters/{id}".freeze
9
+
10
+ class << self
11
+ ##
12
+ # lists all conferences of a presenter
13
+ # @param member_id [String] BigMarker member id (BMID)
14
+ # @param channel_id [String] BigMarker channel id
15
+ # @return [BigMarkerClient::Models::Conference[]]
16
+ def list_conferences(member_id, channel_id)
17
+ result = get(replace_path_params(path: LIST_PRESENTER_CONFERENCES, replacements: { "{id}": member_id }),
18
+ { channel_id: channel_id })
19
+ if result["conferences"]
20
+ return result["conferences"].map { |conference| ::BigMarkerClient::Models::Conference.new(conference) }
21
+ end
22
+
23
+ result
24
+ end
25
+
26
+ ##
27
+ # update a presenter to a conference either with a Models::Presenter object or single properties as hash
28
+ # @param member_id [String] BigMarker member identifier (BMID)
29
+ # @param body [Hash or BigMarkerClient::Models::Presenter]
30
+ # @return [BigMarkerClient::Models::Presenter]
31
+ def update(member_id, body = {})
32
+ body = body.to_h if body.is_a?(::BigMarkerClient::Models::Presenter)
33
+ result = put(replace_path_params(path: UPDATE_PRESENTER, replacements: { "{id}": member_id }), body)
34
+ return ::BigMarkerClient::Models::Presenter.new(result["presenter"]) if result["presenter"]
35
+
36
+ result
37
+ end
38
+
39
+ ##
40
+ # add a presenter to a conference either with a Models::Presenter object or single properties as hash
41
+ # @param conference_id [String] conference identifier
42
+ # @param body [Hash or BigMarkerClient::Models::Presenter]
43
+ # @return [BigMarkerClient::Models::Presenter]
44
+ def create(conference_id, body = {})
45
+ body = body.to_h if body.is_a?(::BigMarkerClient::Models::Base)
46
+ body["conference_id"] = conference_id
47
+ result = post(CREATE_PRESENTER, body)
48
+ return ::BigMarkerClient::Models::Presenter.new(result["presenter"]) if result["presenter"]
49
+
50
+ result
51
+ end
52
+
53
+ ##
54
+ # remove a presenter from a conference
55
+ # @param member_id [String] BigMarker member identifier (BMID)
56
+ def destroy(member_id)
57
+ delete(replace_path_params(path: DELETE_PRESENTER, replacements: { "{id}": member_id }))
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,91 @@
1
+ require "typhoeus"
2
+ require "typhoeus/adapters/faraday"
3
+
4
+ module BigMarkerClient
5
+ class Base
6
+ class << self
7
+ def post(path, body = {})
8
+ request(verb: :post, path: path, params: body)
9
+ end
10
+
11
+ def put(path, body = {})
12
+ request(verb: :put, path: path, params: body)
13
+ end
14
+
15
+ def patch(path, body = {})
16
+ request(verb: :patch, path: path, params: body)
17
+ end
18
+
19
+ def delete(path, body = {})
20
+ request(verb: :delete, path: path, params: body)
21
+ end
22
+
23
+ def get(path, params = {})
24
+ request(verb: :get, path: path, params: params)
25
+ end
26
+
27
+ protected
28
+
29
+ def replace_path_params(path:, replacements: {})
30
+ new_path = path.dup
31
+ replacements.each { |k, v| new_path.gsub!(k.to_s, v) }
32
+ new_path
33
+ end
34
+
35
+ private
36
+
37
+ def request(path:, verb: :get, params: {})
38
+ check_preconditions(verb, path)
39
+
40
+ params = params.to_json unless %w[get delete].include?(verb.to_s)
41
+ response = http_client.send(verb.to_s, base_url(path), params)
42
+ parse_body(response.body)
43
+ end
44
+
45
+ def check_preconditions(verb, path)
46
+ if verb.nil? || path.nil? || BigMarkerClient::Config.api_key.nil?
47
+ raise ArgumentError, "http_method, path or api key is missing"
48
+ end
49
+ raise ArgumentError, "unsupported http_method: #{verb}" unless %w[post put patch delete get].include?(verb.to_s)
50
+ end
51
+
52
+ def http_client
53
+ conn ||= Faraday.new(url: BigMarkerClient::Config.base_url) do |faraday|
54
+ faraday = headers(faraday)
55
+ configure_logging(faraday) if BigMarkerClient::Config.log
56
+ end
57
+ conn.adapter :typhoeus
58
+ conn
59
+ end
60
+
61
+ def headers(adapter)
62
+ adapter.headers["Content-Type"] = "application/json"
63
+ adapter.headers["API-KEY"] = BigMarkerClient::Config.api_key unless BigMarkerClient::Config.api_key.nil?
64
+ adapter
65
+ end
66
+
67
+ def configure_logging(adapter)
68
+ adapter.response :logger do |logger|
69
+ logger.instance_variable_get("@options")[:log_level] = :debug if BigMarkerClient::Config.debug
70
+ logger.filter(/password=([^&]+)/, "password=[FILTERED]")
71
+ logger.filter(/API-KEY: "(\w*)"/, "API-KEY: [FILTERED]")
72
+ end
73
+ adapter
74
+ end
75
+
76
+ def base_url(path)
77
+ BigMarkerClient::Config.base_url + (path.start_with?("/") ? path : "/#{path}")
78
+ end
79
+
80
+ def parse_body(body)
81
+ return nil if body.strip == ""
82
+
83
+ json = JSON.parse(body)
84
+ BigMarkerClient::Config.logger.debug(json) if BigMarkerClient::Config.debug
85
+ json
86
+ rescue JSON::ParserError
87
+ raise BigMarkerClient::ResponseError, "invalid response"
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,29 @@
1
+ module BigMarkerClient
2
+ class Config
3
+ class << self
4
+ attr_accessor :logger
5
+ attr_writer :api_key, :base_url, :log, :debug
6
+
7
+ def base_url
8
+ @base_url ||= "https://www.bigmarker.com/api/v1"
9
+ end
10
+
11
+ def api_key
12
+ @api_key ||= ENV["BIGMARKER_API_KEY"]
13
+ end
14
+
15
+ def log
16
+ @log ||= false
17
+ end
18
+
19
+ def debug
20
+ @debug ||= false
21
+ if @debug && @logger.nil?
22
+ require "logger"
23
+ @logger ||= defined?(Rails.logger) ? Rails.logger : ::Logger.new($stdout)
24
+ end
25
+ @debug
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ module BigMarkerClient
2
+ module Models
3
+ class Attendee < Base
4
+ attr_accessor :email, :first_name, :last_name, :entered_at, :leaved_at, :total_duration, :engaged_duration,
5
+ :chats_count, :qas_count, :polls_count, :polls, :questions, :handouts, :browser_name,
6
+ :browser_version, :device_name
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,31 @@
1
+ module BigMarkerClient
2
+ module Models
3
+ class Base
4
+ def initialize(hash)
5
+ return unless hash.is_a?(Hash)
6
+
7
+ known_attributes = self.class.instance_methods
8
+ hash.each { |k, v| known_attributes.include?(k.to_sym) ? send("#{k}=", v) : warn("missing property: #{k}") }
9
+ end
10
+
11
+ def to_h
12
+ instance_variables.each_with_object({}) do |var, hash|
13
+ value = instance_variable_get(var)
14
+ hash[key(var)] = if value.is_a?(Array) && !value.empty? && value.first.is_a?(::BigMarkerClient::Models::Base)
15
+ value.map(&:to_h)
16
+ elsif value.is_a?(::BigMarkerClient::Models::Base)
17
+ value.to_h
18
+ else
19
+ value
20
+ end
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def key(var)
27
+ var.to_s.sub("@", "")
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,77 @@
1
+ module BigMarkerClient
2
+ module Models
3
+ ##
4
+ # for supported values for time_zone please compare [the documentation](https://docs.bigmarker.com/#time-zones)
5
+ class Conference < Base
6
+ attr_accessor :id, :title, :event_type, :display_language, :meeting_mode, :type, :conference_copy_id,
7
+ :master_webinar_id, :max_attendance, :purpose, :start_time, :duration_minutes, :conference_address,
8
+ :custom_event_id, :channel_id, :webcast_mode, :end_time, :moderator_open_time, :audience_open_time,
9
+ :first_admin_enter_time, :manual_end_time, :privacy, :exit_url, :enable_registration_email,
10
+ :enable_knock_to_enter, :send_reminder_emails_to_presenters, :review_emails,
11
+ :poll_results, :enable_ie_safari, :enable_twitter, :auto_invite_all_channel_members,
12
+ :send_cancellation_email, :show_reviews, :registration_required_to_view_recording,
13
+ :who_can_watch_recording, :show_handout_on_page, :background_image_url, :room_logo, :agenda_topics,
14
+ :disclaimer, :recorded, :recording_url, :recording_iframe,
15
+ # for conference creation
16
+ :sub_url, :enable_dial_in, :time_zone, :schedule_type, :recurring_start_times,
17
+ :presenter_advanced_enter_time, :attendee_advanced_enter_time, :webinar_format,
18
+ :registration_conf_emails, :send_notification_emails_to_presenters, :webhook_url, :channel_admin_id,
19
+ :free_for_all, :room_type, :room_sub_title
20
+
21
+ attr_reader :dial_in_information, :preload_files, :presenters, :webinar_stats, :associated_series
22
+
23
+ # differences between creation and retrieval, use creation as leading (oh well)
24
+ alias can_view_poll_results poll_results
25
+ alias can_view_poll_results= poll_results=
26
+ alias duration duration_minutes
27
+ alias duration= duration_minutes=
28
+ alias enable_review_emails review_emails
29
+ alias enable_review_emails= review_emails=
30
+ alias language display_language
31
+ alias language= display_language=
32
+ alias copy_webinar_id conference_copy_id
33
+ alias copy_webinar_id= conference_copy_id=
34
+
35
+ def dial_in_information=(dial_in_hash)
36
+ @dial_in_information = if dial_in_hash.nil? || !dial_in_hash.is_a?(Hash)
37
+ nil
38
+ else
39
+ DialInInformation.new(dial_in_hash)
40
+ end
41
+ end
42
+
43
+ def preload_files=(file_array)
44
+ @preload_files = if file_array.nil? || !file_array.is_a?(Array) || file_array.empty?
45
+ []
46
+ else
47
+ file_array.map { |file_hash| PreloadFile.new(file_hash) }
48
+ end
49
+ end
50
+
51
+ def presenters=(presenter_array)
52
+ @presenters = if presenter_array.nil? || !presenter_array.is_a?(Array) || presenter_array.empty?
53
+ []
54
+ else
55
+ presenter_array.map { |presenter_hash| Presenter.new(presenter_hash) }
56
+ end
57
+ end
58
+
59
+ def webinar_stats=(webinar_stats_hash)
60
+ @webinar_stats = if webinar_stats_hash.nil? || !webinar_stats_hash.is_a?(Hash)
61
+ nil
62
+ else
63
+ WebinarStats.new(webinar_stats_hash)
64
+ end
65
+ end
66
+
67
+ def associated_series=(series_array)
68
+ @associated_series = if series_array.nil? || !series_array.is_a?(Array) || series_array.empty?
69
+ []
70
+ else
71
+ # TODO: identify element
72
+ series_array.map { |series_hash| series_hash.map { |k, v| "#{k}: #{v}" } }
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,8 @@
1
+ module BigMarkerClient
2
+ module Models
3
+ class DialInInformation < Base
4
+ attr_accessor :dial_in_number, :dial_in_id, :dial_in_passcode, :presenter_dial_in_number, :presenter_dial_in_id,
5
+ :presenter_dial_in_passcode
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module BigMarkerClient
2
+ module Models
3
+ class PreloadFile < Base
4
+ attr_accessor :id, :file_name, :file_type, :file_url
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ module BigMarkerClient
2
+ module Models
3
+ class Presenter < Base
4
+ attr_accessor :presenter_id, :member_id, :conference_id, :name, :display_on_landing_page, :presenter_first_name,
5
+ :presenter_last_name, :presenter_email, :presenter_url, :photo_url, :presenter_dial_in_number,
6
+ :presenter_dial_in_id, :presenter_dial_in_passcode, :title, :bio, :can_manage, :is_moderator,
7
+ :facebook, :twitter, :linkedin, :website,
8
+ # for presenter creation
9
+ :presenter_temporary_password, :send_email_invite, :add_to_channel_subscriber_list
10
+
11
+ # differences between creation and retrieval, use creation as leading (oh well)
12
+ alias display_name name
13
+ alias display_name= name=
14
+ alias email presenter_email
15
+ alias email= presenter_email=
16
+ alias first_name presenter_first_name
17
+ alias first_name= presenter_first_name=
18
+ alias last_name presenter_last_name
19
+ alias last_name= presenter_last_name=
20
+ alias presenter_image_url photo_url
21
+ alias presenter_image_url= photo_url=
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,8 @@
1
+ module BigMarkerClient
2
+ module Models
3
+ class Registrant < Base
4
+ attr_accessor :email, :first_name, :last_name, :custom_fields, :enter_url, :bmid, :referral_domain, :source,
5
+ :tracking_code, :custom_user_id
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module BigMarkerClient
2
+ module Models
3
+ class WebinarStats < Base
4
+ attr_accessor :registrants, :revenue, :total_attendees, :page_views, :invited
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module BigMarkerClient
2
+ VERSION = "0.1.0".freeze
3
+ end
@@ -0,0 +1,35 @@
1
+ require "json"
2
+
3
+ module BigMarkerClient
4
+ class Error < StandardError; end
5
+ class ConnectionError < StandardError; end
6
+ class ClientError < ConnectionError; end
7
+ class ServerError < ConnectionError; end
8
+ class ResponseError < ConnectionError; end
9
+ class NotFound < ResponseError; end
10
+
11
+ autoload :Base, "big_marker_client/base"
12
+ autoload :Config, "big_marker_client/config"
13
+ autoload :Version, "big_marker_client/version"
14
+
15
+ module Api
16
+ module V1
17
+ autoload :Conference, "big_marker_client/api/v1/conference"
18
+ class Conference
19
+ autoload :Registration, "big_marker_client/api/v1/conference/registration"
20
+ end
21
+ autoload :Presenter, "big_marker_client/api/v1/presenter"
22
+ end
23
+ end
24
+
25
+ module Models
26
+ autoload :Attendee, "big_marker_client/models/attendee"
27
+ autoload :Base, "big_marker_client/models/base"
28
+ autoload :Conference, "big_marker_client/models/conference"
29
+ autoload :DialInInformation, "big_marker_client/models/dial_in_information"
30
+ autoload :PreloadFile, "big_marker_client/models/preload_file"
31
+ autoload :Presenter, "big_marker_client/models/presenter"
32
+ autoload :Registrant, "big_marker_client/models/registrant"
33
+ autoload :WebinarStats, "big_marker_client/models/webinar_stats"
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: big_marker_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Burkhard Vogel-Kreykenbohm
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-12-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: typhoeus
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ description: Encapsulates calls to the BigMarker API to create ond retrieve conferences,
56
+ participants, analytics and more
57
+ email:
58
+ - bvk@capinside.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".rspec"
64
+ - ".rubocop.yml"
65
+ - CHANGELOG.md
66
+ - CODE_OF_CONDUCT.md
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/setup
73
+ - lib/big_marker_client.rb
74
+ - lib/big_marker_client/api/v1/conference.rb
75
+ - lib/big_marker_client/api/v1/conference/registration.rb
76
+ - lib/big_marker_client/api/v1/presenter.rb
77
+ - lib/big_marker_client/base.rb
78
+ - lib/big_marker_client/config.rb
79
+ - lib/big_marker_client/models/attendee.rb
80
+ - lib/big_marker_client/models/base.rb
81
+ - lib/big_marker_client/models/conference.rb
82
+ - lib/big_marker_client/models/dial_in_information.rb
83
+ - lib/big_marker_client/models/preload_file.rb
84
+ - lib/big_marker_client/models/presenter.rb
85
+ - lib/big_marker_client/models/registrant.rb
86
+ - lib/big_marker_client/models/webinar_stats.rb
87
+ - lib/big_marker_client/version.rb
88
+ homepage: https://gitlab.com/capinside-oss/big_marker_client
89
+ licenses:
90
+ - MIT
91
+ metadata:
92
+ rubygems_mfa_required: 'true'
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '3.0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubygems_version: 3.2.32
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: simple client library to access the BigMarker API
112
+ test_files: []