class Sourcescrub::Client
Attributes
token[RW]
Public Instance Methods
all_sources(args = { sourceStatus: 'None', limit: 100, offset: 0 })
click to toggle source
The max limit range is 0 - 100
# File lib/sourcescrub/client.rb, line 50 def all_sources(args = { sourceStatus: 'None', limit: 100, offset: 0 }) api = source_api('sources', args) Models::SourceItems.new.parse_response_items( api.kclass_name, get(api.request_url, api.args) ) end
companies(args = { limit: 100, offset: 0 })
click to toggle source
# File lib/sourcescrub/client.rb, line 23 def companies(args = { limit: 100, offset: 0 }) api = companies_api(args) Models::CompanyItems.new.parse_response_items( nil, api.kclass_name, get(api.search_url, api.args) ) end
company(domain, args = {})
click to toggle source
# File lib/sourcescrub/client.rb, line 33 def company(domain, args = {}) api = company_api(domain, args) api.sobject.parse_response get(api.request_url, api.args) end
company_cards(domain, args = {})
click to toggle source
# File lib/sourcescrub/client.rb, line 39 def company_cards(domain, args = {}) api = company_api(domain, args.merge(model_type: company_card_mappings[args[:card_id]])) Models::CompanyItems.new.parse_response_items( domain, api.kclass_name, get(api.request_url, api.args) ) end
headers()
click to toggle source
# File lib/sourcescrub/client.rb, line 17 def headers authenticate if @token.nil? { 'Authorization' => "Bearer #{@token}" } end
source_companies(source_id, args = {})
click to toggle source
# File lib/sourcescrub/client.rb, line 74 def source_companies(source_id, args = {}) api = source_companies_api(source_id, args) Models::CompanyItems.new.parse_response_items( source_id, api.kclass_name, get(api.companies_url, api.args) ) end
source_search(args = {})
click to toggle source
# File lib/sourcescrub/client.rb, line 59 def source_search(args = {}) api = source_search_api(source_params(args)) Models::SourceItems.new.parse_response_items( api.kclass_name, search(api.search_url, api.args) ) end
sources(source_id, args = {})
click to toggle source
# File lib/sourcescrub/client.rb, line 68 def sources(source_id, args = {}) api = source_api(source_id, args) api.sobject.parse_response get(api.request_url, api.args) end
Private Instance Methods
companies_api(args)
click to toggle source
# File lib/sourcescrub/client.rb, line 86 def companies_api(args) Apis::Companies.new( nil, { model_type: 'company' }.merge(args) ) end
company_api(domain, args)
click to toggle source
# File lib/sourcescrub/client.rb, line 93 def company_api(domain, args) Apis::Companies.new( domain, { model_type: 'company' }.merge(args) ) end
company_card_mappings()
click to toggle source
# File lib/sourcescrub/client.rb, line 121 def company_card_mappings { 'sources' => 'source', 'people' => 'person', 'financials' => 'financial', 'investments' => 'investment', 'employees' => 'employee', 'tags' => 'tag', 'employeerange' => 'employee_range' } end
source_api(source_id, args)
click to toggle source
# File lib/sourcescrub/client.rb, line 100 def source_api(source_id, args) Apis::Sources.new( source_id, { model_type: 'source' }.merge(args) ) end
source_companies_api(source_id, args)
click to toggle source
# File lib/sourcescrub/client.rb, line 114 def source_companies_api(source_id, args) Apis::Sources.new( source_id, { model_type: 'company' }.merge(args) ) end
source_search_api(args)
click to toggle source
# File lib/sourcescrub/client.rb, line 107 def source_search_api(args) Apis::Sources.new( nil, { model_type: 'source' }.merge(args) ) end