File tree Expand file tree Collapse file tree 5 files changed +12
-5
lines changed
Expand file tree Collapse file tree 5 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
2323 spec . add_development_dependency 'rake' , '~> 10.3'
2424 spec . add_development_dependency 'mocha' , '~> 1.0'
2525 spec . add_development_dependency "fakeweb" , [ "~> 1.3" ]
26+ spec . add_development_dependency "pry"
2627
2728 spec . add_dependency 'json' , '~> 1.8'
2829 spec . required_ruby_version = '>= 2.1.0'
Original file line number Diff line number Diff line change 44module Intercom
55 class ClientCollectionProxy
66
7- attr_reader :resource_name
7+ attr_reader :resource_name , :finder_url , :resource_class
88
99 def initialize ( resource_name , finder_details : { } , client :)
1010 @resource_name = resource_name
@@ -41,8 +41,6 @@ def [](target_index)
4141
4242 private
4343
44- def resource_class ; @resource_class ; end
45-
4644 def deserialize_response_hash ( response_hash , block )
4745 top_level_type = response_hash . delete ( 'type' )
4846 if resource_name == 'subscriptions'
Original file line number Diff line number Diff line change 88module Intercom
99 module Service
1010 class Contact < BaseService
11+ include ApiOperations ::List
1112 include ApiOperations ::Load
1213 include ApiOperations ::Find
1314 include ApiOperations ::FindAll
Original file line number Diff line number Diff line change @@ -23,15 +23,15 @@ def tag(params)
2323
2424 def untag ( params )
2525 params [ 'tag_or_untag' ] = 'untag'
26- users_or_companies . each do |user_or_company |
26+ users_or_companies ( params ) . each do |user_or_company |
2727 user_or_company [ :untag ] = true
2828 end
2929 create ( params )
3030 end
3131
3232 private
3333
34- def users_or_companies
34+ def users_or_companies ( params )
3535 params [ :users ] || params [ :companies ]
3636 end
3737 end
Original file line number Diff line number Diff line change 33describe "Intercom::Contact" do
44 let ( :client ) { Intercom ::Client . new ( app_id : 'app_id' , api_key : 'api_key' ) }
55
6+ it 'should be listable' do
7+ proxy = client . contacts . all
8+ proxy . resource_name . must_equal 'contacts'
9+ proxy . finder_url . must_equal '/contacts'
10+ proxy . resource_class . must_equal Intercom ::Contact
11+ end
12+
613 it 'should not throw ArgumentErrors when there are no parameters' do
714 client . expects ( :post )
815 client . contacts . create
You can’t perform that action at this time.
0 commit comments