From 7bf46d34ef701f661b02a0fa99147fae71fcde25 Mon Sep 17 00:00:00 2001 From: knatsuki Date: Tue, 26 Dec 2017 12:34:51 -0800 Subject: [PATCH] Add CommunicationContent Resource --- lib/frederick_api.rb | 3 ++- lib/frederick_api/v2/communication_content.rb | 11 +++++++++++ lib/frederick_api/version.rb | 2 +- .../v2/communication_content_spec.rb | 19 +++++++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 lib/frederick_api/v2/communication_content.rb create mode 100644 spec/frederick_api/v2/communication_content_spec.rb diff --git a/lib/frederick_api.rb b/lib/frederick_api.rb index fd0f7b9..6902d70 100644 --- a/lib/frederick_api.rb +++ b/lib/frederick_api.rb @@ -21,8 +21,9 @@ # Public resources require 'frederick_api/v2/business_category' -# Froldoex resources +# Core resources require 'frederick_api/v2/automation' +require 'frederick_api/v2/communication_content' require 'frederick_api/v2/contact' require 'frederick_api/v2/contact_property' require 'frederick_api/v2/contact_list' diff --git a/lib/frederick_api/v2/communication_content.rb b/lib/frederick_api/v2/communication_content.rb new file mode 100644 index 0000000..f4284bb --- /dev/null +++ b/lib/frederick_api/v2/communication_content.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module FrederickAPI + module V2 + # /v2/locations/:location_id/communication_contents + class CommunicationContent < Resource + belongs_to :location + self.read_only_attributes += [:location_id] + end + end +end diff --git a/lib/frederick_api/version.rb b/lib/frederick_api/version.rb index 7a61fe9..481252d 100644 --- a/lib/frederick_api/version.rb +++ b/lib/frederick_api/version.rb @@ -2,5 +2,5 @@ module FrederickAPI # Current gem version - VERSION = '0.4.1' + VERSION = '0.4.2' end diff --git a/spec/frederick_api/v2/communication_content_spec.rb b/spec/frederick_api/v2/communication_content_spec.rb new file mode 100644 index 0000000..9a8b100 --- /dev/null +++ b/spec/frederick_api/v2/communication_content_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe FrederickAPI::V2::CommunicationContent do + it_behaves_like 'v2_resource' + it_behaves_like 'belongs_to :location' + + describe 'class attributes' do + describe 'read_only_attributes' do + let(:base_read_only_attributes) { %i[id type links meta relationships] } + + it 'has right read only attributes' do + expect(described_class.read_only_attributes).to eq base_read_only_attributes + [:location_id] + expect(described_class.superclass.read_only_attributes).to eq base_read_only_attributes + end + end + end +end