diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..a4dd9db --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.7.4 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ef48502..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -sudo: false -language: ruby -rvm: - - 2.5.0 - - 2.4.0 - - 2.3.0 - - 2.2.0 -before_install: - - gem install bundler -v 1.16.1 diff --git a/Gemfile b/Gemfile index 37e7e9f..d2fceab 100644 --- a/Gemfile +++ b/Gemfile @@ -2,5 +2,4 @@ source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } -# Specify your gem's dependencies in demio_ruby.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index e8fdf38..a0f95df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,73 +1,73 @@ PATH remote: . specs: - demio-ruby (0.1.0) + demio-ruby (0.2.0) GEM remote: https://rubygems.org/ specs: - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - ast (2.4.0) - coderay (1.1.2) - crack (0.4.3) - safe_yaml (~> 1.0.0) - diff-lcs (1.3) - hashdiff (0.3.7) - jaro_winkler (1.5.1) - method_source (0.8.2) - parallel (1.12.1) - parser (2.5.1.0) - ast (~> 2.4.0) - powerpack (0.1.2) - pry (0.10.4) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - public_suffix (3.0.2) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + ast (2.4.2) + coderay (1.1.3) + crack (0.4.5) + rexml + diff-lcs (1.4.4) + hashdiff (1.0.1) + method_source (1.0.0) + parallel (1.20.1) + parser (3.0.2.0) + ast (~> 2.4.1) + pry (0.14.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.6) rainbow (3.0.0) - rake (10.5.0) - rspec (3.7.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-core (3.7.0) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + rake (13.0.6) + regexp_parser (2.1.1) + rexml (3.2.5) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.1) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-support (3.7.0) - rubocop (0.57.2) - jaro_winkler (~> 1.5.1) + rspec-support (~> 3.10.0) + rspec-support (3.10.2) + rubocop (1.18.3) parallel (~> 1.10) - parser (>= 2.5) - powerpack (~> 0.1) + parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.7.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.9.0) - safe_yaml (1.0.4) - slop (3.6.0) - unicode-display_width (1.4.0) - webmock (3.4.2) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.7.0) + parser (>= 3.0.1.1) + ruby-progressbar (1.11.0) + unicode-display_width (2.0.0) + webmock (3.13.0) addressable (>= 2.3.6) crack (>= 0.3.2) - hashdiff + hashdiff (>= 0.4.0, < 2.0.0) PLATFORMS ruby DEPENDENCIES - bundler (~> 1.16) + bundler (~> 2.2.23) demio-ruby! - pry (~> 0.10.3) - rake (~> 10.0) - rspec (~> 3.0) - rubocop (~> 0.57.1) - webmock (~> 3.4) + pry (~> 0.14.1) + rake (~> 13.0.6) + rspec (~> 3.10.0) + rubocop (~> 1.18.3) + webmock (~> 3.13.0) BUNDLED WITH - 1.16.1 + 2.2.23 diff --git a/README.md b/README.md index 8a519de..7fc3d0c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Demio Ruby Client -[![Build Status](https://travis-ci.org/samudary/demio-ruby.svg?branch=master)](https://travis-ci.org/samudary/demio-ruby) +![example workflow](https://github.com/samudary/demio-ruby/actions/workflows/ruby.yml/badge.svg) + A Ruby gem for interacting with the [Demio API](https://publicdemioapi.docs.apiary.io/). @@ -37,7 +38,8 @@ client = Demio::Client.new( | :------------------------- | :--------------------------------------------------- | | List events | `#events` | | Fetch an event | `#event(event_id)` | -| Fetch event date info | `#event_date(event_id, date_id)` | +| Fetch event date info | `#event_date(event_id, event_date_id)` | +| Fetch participants list | `#participants(event_date_id)` | | Register a registrant | `#register(payload = {})` | | Ping | `#ping` | diff --git a/bin/console b/bin/console index e93130b..69ad680 100755 --- a/bin/console +++ b/bin/console @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require "bundler/setup" require "demio" diff --git a/demio-ruby.gemspec b/demio-ruby.gemspec index d0c13f8..870c3cb 100644 --- a/demio-ruby.gemspec +++ b/demio-ruby.gemspec @@ -24,10 +24,10 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.1' - spec.add_development_dependency "bundler", "~> 1.16" - spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "rspec", "~> 3.0" - spec.add_development_dependency "rubocop", "~> 0.57.1" - spec.add_development_dependency "pry", "~> 0.10.3" - spec.add_development_dependency "webmock", "~> 3.4" + spec.add_development_dependency "bundler", "~> 2.2.23" + spec.add_development_dependency "rake", "~> 13.0.6" + spec.add_development_dependency "rspec", "~> 3.10.0" + spec.add_development_dependency "rubocop", "~> 1.18.3" + spec.add_development_dependency "pry", "~> 0.14.1" + spec.add_development_dependency "webmock", "~> 3.13.0" end diff --git a/lib/demio/client.rb b/lib/demio/client.rb index a763552..ae7da4e 100644 --- a/lib/demio/client.rb +++ b/lib/demio/client.rb @@ -4,6 +4,7 @@ require "demio/event" require "demio/event_date" require "demio/events" +require "demio/participants" require "demio/register" require "json" require "net/http" @@ -14,10 +15,13 @@ class Client include Event include EventDate include Events + include Participants include Register attr_reader :api_key, :api_secret + REQUEST_REDIRECT_FOLLOW_LIMIT = 10 + def initialize(options = {}) @api_key = options[:api_key] @api_secret = options[:api_secret] @@ -40,28 +44,33 @@ def ping private - def make_request(verb_klass, uri, payload = {}, limit = 10) - raise TooManyRedirectsError, "too many HTTP redirects" if limit.zero? + def make_request(verb_klass, uri, payload = {}, request_limit = REQUEST_REDIRECT_FOLLOW_LIMIT) + raise TooManyRedirectsError, "too many HTTP redirects" if request_limit.zero? - uri = format_uri(uri) + uri = redirected_request?(request_limit) ? URI(uri) : format_uri(uri) Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| - request = verb_klass.new uri - request = create_headers(request) - - request.body = payload.to_json if verb_klass == Net::HTTP::Put - - response = http.request request - - case response - when Net::HTTPSuccess then - response - when Net::HTTPRedirection then - location = response["location"] - make_request(verb_klass, location, payload, limit - 1) - else - response.value - end + response = http.request(create_request(verb_klass, uri, payload)) + handle_response(response, verb_klass, payload, request_limit) + end + end + + def create_request(verb_klass, uri, payload) + request = verb_klass.new(uri) + request = create_headers(request) + request.body = payload.to_json if verb_klass == Net::HTTP::Put + request + end + + def handle_response(response, verb_klass, payload, request_limit) + case response + when Net::HTTPSuccess + response + when Net::HTTPRedirection + location = response["Location"] + make_request(verb_klass, location, payload, request_limit - 1) + else + response.value end end @@ -73,6 +82,10 @@ def create_headers(request) request end + def redirected_request?(request_limit) + request_limit < REQUEST_REDIRECT_FOLLOW_LIMIT + end + def format_uri(path) URI(base_uri + path) end diff --git a/lib/demio/event.rb b/lib/demio/event.rb index 35e4e0b..8e24859 100644 --- a/lib/demio/event.rb +++ b/lib/demio/event.rb @@ -6,9 +6,11 @@ module Event # Fetches a single event from Demio # # @param id [String] - # @return [Net::HTTPCreated] - def event(id) - get "event/#{id}" + # @param active [Boolean] + # @return [Net::HTTPOk] + def event(id, active = nil) + active_param = active ? "?active=#{active}" : nil + get "event/#{id}#{active_param}" end end end diff --git a/lib/demio/event_date.rb b/lib/demio/event_date.rb index 7d8c353..6f39b54 100644 --- a/lib/demio/event_date.rb +++ b/lib/demio/event_date.rb @@ -5,11 +5,11 @@ class Client module EventDate # Fetches info about a specific date from Demio # - # @param id [String] - # @param date_id [String] - # @return [Net::HTTPCreated] - def event_date(id, date_id) - get "event/#{id}/#{date_id}" + # @param event_id [String] + # @param event_date_id [String] + # @return [Net::HTTPOk] + def event_date(event_id, event_date_id) + get "event/#{event_id}/date/#{event_date_id}" end end end diff --git a/lib/demio/events.rb b/lib/demio/events.rb index 337ec03..5922a98 100644 --- a/lib/demio/events.rb +++ b/lib/demio/events.rb @@ -5,9 +5,11 @@ class Client module Events # Fetches all events from Demio # - # @return [Net::HTTPCreated] - def events - get "events" + # @param type [String] + # @return [Net::HTTPOk] + def events(type = nil) + type_param = type ? "?type=#{type}" : nil + get "events#{type_param}" end end end diff --git a/lib/demio/participants.rb b/lib/demio/participants.rb new file mode 100644 index 0000000..cff390a --- /dev/null +++ b/lib/demio/participants.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Demio + class Client + module Participants + # Returns Event Date participants list + # + # @param event_date_id [String] + # @params status [String] + # @return [Net::HTTPOk] + def participants(event_date_id, status = nil) + status_param = status ? "?status=#{status}" : nil + get "report/#{event_date_id}/participants#{status_param}" + end + end + end +end diff --git a/lib/demio/register.rb b/lib/demio/register.rb index e93b790..51a7b58 100644 --- a/lib/demio/register.rb +++ b/lib/demio/register.rb @@ -4,6 +4,7 @@ module Demio class Client module Register # Adds a registrant to an event in Demio + # Docs: https://publicdemioapi.docs.apiary.io/#reference/events/register/register # # @param payload [Hash] # @return [Net::HTTPCreated] diff --git a/lib/demio/version.rb b/lib/demio/version.rb index 1174147..b2cfd16 100644 --- a/lib/demio/version.rb +++ b/lib/demio/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Demio - VERSION = "0.1.0".freeze + VERSION = "0.2.0" end diff --git a/spec/client_spec.rb b/spec/client_spec.rb index ac6b866..204d8a0 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -1,11 +1,14 @@ +# frozen_string_literal: true + RSpec.describe Demio::Client do - before(:each) do - options = { + let(:options) do + { api_secret: "12345", api_key: "xyz0987" } - @client = Demio::Client.new(options) end + let(:stubbed_response_body) { [{ id: 1, value: "test" }].to_json } + let(:client) { described_class.new(options) } context "request headers" do it "correctly sets headers" do @@ -14,39 +17,100 @@ "https://my.demio.com/api/v1/ping/query?api_key=xyz0987&api_secret=12345" ) - @client.ping + client.ping expect( a_request( :get, "https://my.demio.com/api/v1/ping/query?api_key=xyz0987&api_secret=12345" + ).with( + headers: { + "Api-Key" => "xyz0987", + "Api-Secret" => "12345", + "Content-Type" => "application/json", + "User-Agent" => "Demio Ruby Client - #{Demio::VERSION}" + } ) - .with(headers: { - "Api-Key" => "xyz0987", - "Api-Secret" => "12345", - "Content-Type" => "application/json", - "User-Agent" => "Demio Ruby Client - #{Demio::VERSION}" - }) ).to have_been_made.times(1) end end context "#ping" do it "makes a GET ping request" do - ping_response = { - "pong" => true - } + ping_response = { "pong" => true } stub_request(:get, "https://my.demio.com/api/v1/ping/query?api_key=xyz0987&api_secret=12345") .to_return(body: ping_response.to_json, status: 200) - response = @client.ping + response = client.ping expect(response.code).to eq("200") expect( a_request( - :get, - "https://my.demio.com/api/v1/ping/query?api_key=xyz0987&api_secret=12345" + :get, "https://my.demio.com/api/v1/ping/query?api_key=xyz0987&api_secret=12345" ) ).to have_been_made.times(1) end end + + context "#get" do + it "makes a GET request" do + target_path = "endpoint?query=1" + stub_request(:get, "https://my.demio.com/api/v1/#{target_path}") + .to_return(body: stubbed_response_body, status: 200) + + response = client.get(target_path) + expect(response.code).to eq("200") + expect(response.body).to eq(stubbed_response_body) + expect( + a_request( + :get, "https://my.demio.com/api/v1/#{target_path}" + ) + ).to have_been_made.times(1) + end + end + + context "#put" do + it "makes a PUT request" do + target_path = "endpoint" + payload = { event_id: 1234 } + + stub_request(:put, "https://my.demio.com/api/v1/#{target_path}") + .with(body: payload.to_json) + .to_return(body: stubbed_response_body, status: 200) + + response = client.put(target_path, payload) + expect(response.code).to eq("200") + expect(response.body).to eq(stubbed_response_body) + expect(a_request(:put, "https://my.demio.com/api/v1/#{target_path}") + .with(body: payload.to_json)) + .to have_been_made.times(1) + end + end + + context "response is a redirect" do + it "follows the redirect" do + target_path = "endpoint?query=1" + follow_url = "https://my.demio.com/api/v1/redirect" + stub_request(:get, "https://my.demio.com/api/v1/#{target_path}") + .to_return(headers: { "Location" => follow_url }, body: stubbed_response_body, status: 301) + stub_request(:get, follow_url) + .to_return(body: stubbed_response_body, status: 200) + + response = client.get(target_path) + expect(response.code).to eq("200") + expect(a_request(:get, "https://my.demio.com/api/v1/#{target_path}")) + .to have_been_made.times(1) + expect(a_request(:get, follow_url)) + .to have_been_made.times(1) + end + + it "raises an error if number of redirects exceed the limit" do + target_path = "endpoint?query=1" + stub_const("Demio::Client::REQUEST_REDIRECT_FOLLOW_LIMIT", 1) + stub_request(:get, "https://my.demio.com/api/v1/#{target_path}") + .to_return(body: stubbed_response_body, status: 301) + + expect { client.get(target_path) } + .to raise_error(Demio::TooManyRedirectsError, "too many HTTP redirects") + end + end end diff --git a/spec/demio_spec.rb b/spec/demio_spec.rb index 84b3f47..0c99231 100644 --- a/spec/demio_spec.rb +++ b/spec/demio_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe Demio do it "has a version number" do expect(Demio::VERSION).not_to be nil diff --git a/spec/event_date_spec.rb b/spec/event_date_spec.rb index 55d7710..ebe25ec 100644 --- a/spec/event_date_spec.rb +++ b/spec/event_date_spec.rb @@ -1,29 +1,32 @@ +# frozen_string_literal: true + RSpec.describe Demio::Client::EventDate do - before(:each) do - options = { + let(:options) do + { api_secret: "12345", api_key: "xyz0987" } - @client = Demio::Client.new(options) end + let(:client) { Demio::Client.new(options) } it "makes a GET request to Demio's event date endpoint" do event_id = 4567 date_id = 35 - event_response = { + stubbed_event_response_body = { "date_id" => 35, "status" => "scheduled", "timestamp" => 1_456_723_800, "datetime" => "March 26th, 2016 at 8:00PM EET", "zone" => "Europe/Kiev" - } + }.to_json - stub_request(:get, "https://my.demio.com/api/v1/event/#{event_id}/#{date_id}") - .to_return(body: event_response.to_json, status: 200) + stub_request(:get, "https://my.demio.com/api/v1/event/#{event_id}/date/#{date_id}") + .to_return(body: stubbed_event_response_body, status: 200) - response = @client.event_date(event_id, date_id) + response = client.event_date(event_id, date_id) expect(response.code).to eq("200") - expect(a_request(:get, "https://my.demio.com/api/v1/event/#{event_id}/#{date_id}")) + expect(response.body).to eq(stubbed_event_response_body) + expect(a_request(:get, "https://my.demio.com/api/v1/event/#{event_id}/date/#{date_id}")) .to have_been_made.times(1) end end diff --git a/spec/event_spec.rb b/spec/event_spec.rb index 95a89db..c4afd8f 100644 --- a/spec/event_spec.rb +++ b/spec/event_spec.rb @@ -1,27 +1,44 @@ +# frozen_string_literal: true + RSpec.describe Demio::Client::Event do - before(:each) do - options = { + let(:options) do + { api_secret: "12345", api_key: "xyz0987" } - @client = Demio::Client.new(options) end - - it "makes a GET request to Demio's event fetch endpoint" do - event_id = 4567 - event = { + let(:client) { Demio::Client.new(options) } + let(:event_id) { 4567 } + let(:stubbed_response_body) do + { "id" => event_id, "date_id" => 35, "name" => "John Doe", "email" => "john.doe@gmail.com" - } + }.to_json + end + it "makes a GET request to Demio's event endpoint" do stub_request(:get, "https://my.demio.com/api/v1/event/#{event_id}") - .to_return(body: event.to_json, status: 200) + .to_return(body: stubbed_response_body, status: 200) - response = @client.event(event_id) + response = client.event(event_id) expect(response.code).to eq("200") + expect(response.body).to eq(stubbed_response_body) expect(a_request(:get, "https://my.demio.com/api/v1/event/#{event_id}")) .to have_been_made.times(1) end + + context "with additional param" do + it "makes a GET request to Demio's event endpoint with param" do + stub_request(:get, "https://my.demio.com/api/v1/event/#{event_id}?active=true") + .to_return(body: stubbed_response_body, status: 200) + + response = client.event(event_id, true) + expect(response.code).to eq("200") + expect(response.body).to eq(stubbed_response_body) + expect(a_request(:get, "https://my.demio.com/api/v1/event/#{event_id}?active=true")) + .to have_been_made.times(1) + end + end end diff --git a/spec/events_spec.rb b/spec/events_spec.rb index 1975350..ee4f97f 100644 --- a/spec/events_spec.rb +++ b/spec/events_spec.rb @@ -1,14 +1,15 @@ +# frozen_string_literal: true + RSpec.describe Demio::Client::Events do - before(:each) do - options = { + let(:options) do + { api_secret: "12345", api_key: "xyz0987" } - @client = Demio::Client.new(options) end - - it "makes a GET request to Demio's event listing endpoint" do - response = [ + let(:client) { Demio::Client.new(options) } + let(:stubbed_response_body) do + [ { "id" => 62, "name" => "First Webinar", @@ -27,13 +28,30 @@ "zone" => "America/New_York", "registration_url" => "http://my.demio.loc/ref/pgRzWQhYLPmuboOA" } - ] + ].to_json + end + + it "makes a GET request to Demio's event listing endpoint" do stub_request(:get, "https://my.demio.com/api/v1/events") - .to_return(body: response.to_json, status: 200) + .to_return(body: stubbed_response_body, status: 200) - response = @client.events + response = client.events expect(response.code).to eq("200") + expect(response.body).to eq(stubbed_response_body) expect(a_request(:get, "https://my.demio.com/api/v1/events")) .to have_been_made.times(1) end + + context "with additional param" do + it "makes a GET request to Demio's event listing endpoint with param" do + stub_request(:get, "https://my.demio.com/api/v1/events?type=upcoming") + .to_return(body: stubbed_response_body, status: 200) + + response = client.events("upcoming") + expect(response.code).to eq("200") + expect(response.body).to eq(stubbed_response_body) + expect(a_request(:get, "https://my.demio.com/api/v1/events?type=upcoming")) + .to have_been_made.times(1) + end + end end diff --git a/spec/participants_spec.rb b/spec/participants_spec.rb new file mode 100644 index 0000000..4caa63d --- /dev/null +++ b/spec/participants_spec.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +RSpec.describe Demio::Client::Participants do + let(:options) do + { + api_secret: "12345", + api_key: "xyz0987" + } + end + let(:client) { Demio::Client.new(options) } + let(:stubbed_response_body) do + { + "participants" => [ + { + "email" => "simulation+dave@demio.com", + "name" => "Dave", + "custom_fields" => [], + "attended" => false, + "status" => "did not attend" + }, + { + "email" => "simulation+ansley@demio.com", + "name" => "Ansley", + "custom_fields" => [], + "attended" => false, + "status" => "did not attend" + } + ] + }.to_json + end + let(:event_date_id) { 1234 } + + it "makes a GET request to Demio's participants endpoint" do + stub_request(:get, "https://my.demio.com/api/v1/report/#{event_date_id}/participants") + .to_return(body: stubbed_response_body, status: 200) + + response = client.participants(event_date_id) + expect(response.code).to eq("200") + expect(response.body).to eq(stubbed_response_body) + expect(a_request(:get, "https://my.demio.com/api/v1/report/#{event_date_id}/participants")) + .to have_been_made.times(1) + end + + context "with additional param" do + it "makes a GET request to Demio's participants endpoint with param" do + stub_request(:get, "https://my.demio.com/api/v1/report/#{event_date_id}/participants?status=left-early") + .to_return(body: stubbed_response_body, status: 200) + + response = client.participants(event_date_id, "left-early") + expect(response.code).to eq("200") + expect(response.body).to eq(stubbed_response_body) + expect(a_request(:get, "https://my.demio.com/api/v1/report/#{event_date_id}/participants?status=left-early")) + .to have_been_made.times(1) + end + end +end diff --git a/spec/register_spec.rb b/spec/register_spec.rb index e2c2497..3c92813 100644 --- a/spec/register_spec.rb +++ b/spec/register_spec.rb @@ -1,11 +1,13 @@ +# frozen_string_literal: true + RSpec.describe Demio::Client::Register do - before(:each) do - options = { + let(:options) do + { api_secret: "12345", api_key: "xyz0987" } - @client = Demio::Client.new(options) end + let(:client) { Demio::Client.new(options) } it "makes a PUT request to Demio's event registration endpoint" do payload = { @@ -14,16 +16,17 @@ "name" => "Jane Doe", "email" => "jane.doe@gmail.com" } - registration_response = { + stubbed_registration_response_body = { "join_link" => "https://event.demio.com/join/fPaSYijVHXI6ZJgE" - } + }.to_json stub_request(:put, "https://my.demio.com/api/v1/event/register") .with(body: payload.to_json) - .to_return(body: registration_response.to_json, status: 200) + .to_return(body: stubbed_registration_response_body, status: 201) - response = @client.register(payload) - expect(response.code).to eq("200") + response = client.register(payload) + expect(response.code).to eq("201") + expect(response.body).to eq(stubbed_registration_response_body) expect(a_request(:put, "https://my.demio.com/api/v1/event/register") .with(body: payload.to_json)) .to have_been_made.times(1) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b8a87a1..3529627 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "bundler/setup" require "demio" require "webmock/rspec"