Class: ContextIO::Files
Constant Summary
collapse
- FILE_READERS =
%I(size type subject date date_indexed addresses person_info
file_name file_name_structure body_section supports_preview
is_embedded content_disposition content_id message_id
email_message_id gmail_message_id gmail_thread_id email_addresses
created first_name id last_name resource_url sources is_tnef_part)
Instance Attribute Summary collapse
Instance Method Summary
collapse
#build_url, #call_api_return_new_object, #call_api_return_updated_object, #delete, #get, #get_request, #parse_response, #return_post_api_call_made, #success?, #validate_params
#collection_return, #contact_collection_return
Constructor Details
#initialize(parent:, identifier: nil, response: nil, status: nil, success: nil, api_call_made: nil) ⇒ Files
Returns a new instance of Files.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/context_io/account/files.rb', line 16
def initialize(parent:,
identifier: nil,
response: nil,
status: nil,
success: nil,
api_call_made: nil)
@parent = parent
@connection = parent.connection
@file_id = identifier
@status = status
@success = success
@api_call_made = api_call_made
if response
parse_response(response)
end
end
|
Instance Attribute Details
#api_call_made ⇒ Object
Returns the value of attribute api_call_made.
14
15
16
|
# File 'lib/context_io/account/files.rb', line 14
def api_call_made
@api_call_made
end
|
Instance Method Details
#call_url ⇒ Object
33
34
35
|
# File 'lib/context_io/account/files.rb', line 33
def call_url
build_url("files", file_id)
end
|
37
38
39
|
# File 'lib/context_io/account/files.rb', line 37
def contact_url?
parent.call_url.include?("/contacts/")
end
|
41
42
43
|
# File 'lib/context_io/account/files.rb', line 41
def contact_url_error
raise StandardError, "This method can only be called from '2.0/accounts/:account/file/:file_id'" if contact_url?
end
|
#get_content(**kwargs) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/context_io/account/files.rb', line 45
def get_content(**kwargs)
contact_url_error
call_api_return_new_object(klass: Files,
url: "#{call_url}/content",
valid_params: ValidGetParams::FILE_CONTENT,
given_params: kwargs)
end
|
53
54
55
56
|
# File 'lib/context_io/account/files.rb', line 53
def get_related
contact_url_error
get_request(url: "#{call_url}/related")
end
|