Skip to content

Commit

Permalink
Merge pull request #7 from HireFrederick/add_communication_content
Browse files Browse the repository at this point in the history
Add CommunicationContent Resource
  • Loading branch information
knatsuki authored Dec 26, 2017
2 parents 910a87c + 7bf46d3 commit d41f847
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/frederick_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 11 additions & 0 deletions lib/frederick_api/v2/communication_content.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion lib/frederick_api/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module FrederickAPI
# Current gem version
VERSION = '0.4.1'
VERSION = '0.4.2'
end
19 changes: 19 additions & 0 deletions spec/frederick_api/v2/communication_content_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d41f847

Please sign in to comment.