dynamicloud 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/configuration.rb +2 -2
- data/lib/dynamic_api.rb +0 -75
- data/lib/dynamicloud/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 338eb020d30f9fba244b490b2f901a1fc315d3cf
|
4
|
+
data.tar.gz: 2cf767fc04cc135ab864f955cfaf85d701eec1f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2c1815d4e9663698d0c89ec13a8297f37b26102816789dad99cefb1f70ca4aed72057d8c0c44bc03c6c2c77a8f9f19581dde2f85c458c1522e752c0b8c413ad
|
7
|
+
data.tar.gz: d64c146d4ef6daf2de4c8521e4d63a9aa3f95db37618ca4d0818c991a983c732dd54c04710207d3c7ea4e1ce10f7631e209247c7f7417a64fbab6822a627621e
|
data/lib/configuration.rb
CHANGED
@@ -13,7 +13,7 @@ class Configuration
|
|
13
13
|
# Load the current properties in config.yml.
|
14
14
|
def initialize
|
15
15
|
@config = {
|
16
|
-
:url => '
|
16
|
+
:url => 'https://api.dynamicloud.org',
|
17
17
|
# this url must be executed using post method
|
18
18
|
:url_get_records => '/api_models/{csk}/{aci}/get_records/{mid}/{count}/{offset}/',
|
19
19
|
# this url must be executed using post method
|
@@ -42,7 +42,7 @@ class Configuration
|
|
42
42
|
:url_update_selection => '/api_records/{csk}/{aci}/update_using_selection/{mid}',
|
43
43
|
# this url must be executed using post method
|
44
44
|
:url_delete_selection => '/api_records/{csk}/{aci}/delete_using_selection/{mid}',
|
45
|
-
:version => '1.0.
|
45
|
+
:version => '1.0.6'
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
data/lib/dynamic_api.rb
CHANGED
@@ -509,81 +509,6 @@ module Dynamicloud
|
|
509
509
|
fields
|
510
510
|
end
|
511
511
|
|
512
|
-
# Uploads a file in record <b>rid</b>
|
513
|
-
# @param mid owner model id of this record <b>rid<b/>
|
514
|
-
# @param rid record id
|
515
|
-
# @param field_name fieldName target
|
516
|
-
# @param file file to upload
|
517
|
-
# @param content_type contentType of this file
|
518
|
-
# @param preferred_name preferred name to later downloads
|
519
|
-
def upload_file(mid, rid, field_name, file, content_type, preferred_name)
|
520
|
-
url = Configuration::PROPERTIES.get_property :url
|
521
|
-
url_get_records = Configuration::PROPERTIES.get_property :url_upload_file
|
522
|
-
|
523
|
-
url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])
|
524
|
-
url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])
|
525
|
-
url_get_records = url_get_records.gsub '{mid}', mid.to_s
|
526
|
-
url_get_records = url_get_records.gsub '{rid}', rid.to_s
|
527
|
-
|
528
|
-
params = {
|
529
|
-
:pickedFileName => File.basename(file.path),
|
530
|
-
:file_type => content_type,
|
531
|
-
:file_name => preferred_name,
|
532
|
-
:identifier => field_name,
|
533
|
-
'files[]' => file
|
534
|
-
}
|
535
|
-
|
536
|
-
response = DynamicService::ServiceCaller.call_service url + url_get_records, params, 'post'
|
537
|
-
|
538
|
-
json = JSON.parse(response)
|
539
|
-
unless json['status'] == 200
|
540
|
-
raise json['message']
|
541
|
-
end
|
542
|
-
end
|
543
|
-
|
544
|
-
# This method will make a request to generate a link to download the file related to this recordId and fieldName
|
545
|
-
# @param mid model id
|
546
|
-
# @param rid record id
|
547
|
-
# @param field_name field name
|
548
|
-
# @return link to share file
|
549
|
-
def share_file(mid, rid, field_name)
|
550
|
-
url = Configuration::PROPERTIES.get_property :url
|
551
|
-
url_get_records = Configuration::PROPERTIES.get_property :url_share_file
|
552
|
-
|
553
|
-
url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])
|
554
|
-
url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])
|
555
|
-
url_get_records = url_get_records.gsub '{mid}', mid.to_s
|
556
|
-
url_get_records = url_get_records.gsub '{rid}', rid.to_s
|
557
|
-
url_get_records = url_get_records.gsub '{identifier}', field_name
|
558
|
-
|
559
|
-
response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'
|
560
|
-
|
561
|
-
json = JSON.parse(response)
|
562
|
-
unless json['status'] == 200
|
563
|
-
raise json['message']
|
564
|
-
end
|
565
|
-
|
566
|
-
json['link']
|
567
|
-
end
|
568
|
-
|
569
|
-
# Downloads a file according <b>rid</b> and <b>fieldName</b>
|
570
|
-
# @param mid owner model id of this record <b>rid<b/>
|
571
|
-
# @param rid record id
|
572
|
-
# @param field_name fieldName target
|
573
|
-
# @param file_destiny destiny file. If this file doesn't exist then will be created
|
574
|
-
def download_file(mid, rid, field_name, file_destiny)
|
575
|
-
url = Configuration::PROPERTIES.get_property :url
|
576
|
-
url_get_records = Configuration::PROPERTIES.get_property :url_download_file
|
577
|
-
|
578
|
-
url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])
|
579
|
-
url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])
|
580
|
-
url_get_records = url_get_records.gsub '{mid}', mid.to_s
|
581
|
-
url_get_records = url_get_records.gsub '{rid}', rid.to_s
|
582
|
-
url_get_records = url_get_records.gsub '{identifier}', field_name
|
583
|
-
|
584
|
-
DynamicService::ServiceCaller.call_service url + url_get_records, {}, {}, {}, file_destiny
|
585
|
-
end
|
586
|
-
|
587
512
|
# Executes an update using query as a selection and data with values
|
588
513
|
# Dynamicloud will normalize the key pair values. That is, will be used field identifiers only.
|
589
514
|
# @param data data that will be sent to Dynamicloud servers
|
data/lib/dynamicloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamicloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dynamicloud
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: httpclient
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.5.3.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.5.3.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|