Class: Sourcescrub::Client
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
source_params
authenticate, get, search
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
15
16
17
|
# File 'lib/sourcescrub/client.rb', line 15
def token
@token
end
|
Instance Method Details
#all_sources(args = { sourceStatus: 'None', limit: 100, offset: 0 }) ⇒ Object
The max limit range is 0 - 100
50
51
52
53
54
55
56
57
|
# 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 }) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# 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(identifier, args = {}) ⇒ Object
33
34
35
36
37
|
# File 'lib/sourcescrub/client.rb', line 33
def company(identifier, args = {})
api = company_api(identifier, args)
api.sobject.parse_response get(api.request_url, api.args)
end
|
#company_cards(identifier, args = {}) ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/sourcescrub/client.rb', line 39
def company_cards(identifier, args = {})
api = company_api(identifier, args.merge(model_type: company_card_mappings[args[:card_id]]))
Models::CompanyItems.new.parse_response_items(
identifier,
api.kclass_name,
get(api.request_url, api.args)
)
end
|
17
18
19
20
21
|
# File 'lib/sourcescrub/client.rb', line 17
def
authenticate if @token.nil?
{ 'Authorization' => "Bearer #{@token}" }
end
|
#source_companies(source_id, args = {}) ⇒ Object
74
75
76
77
78
79
80
81
82
|
# 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 = {}) ⇒ Object
59
60
61
62
63
64
65
66
|
# 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 = {}) ⇒ Object
68
69
70
71
72
|
# 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
|