glossyapp 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7883e4236723bd664cc989af7d5f0bd0ee065126
4
- data.tar.gz: 0217949244cfd0e63510428f3479bf761035a87b
3
+ metadata.gz: 7b9f33001250456bf689e8016c09857a47f03ae1
4
+ data.tar.gz: 4e46de782304cb6342a2f9fe6fb16b73cc7ac321
5
5
  SHA512:
6
- metadata.gz: c8caa0f726a9e57d593cce8b51f532eb8da2d6afb980332b35f2f379bd53abb909f2ef81bf1b0ab13f7b645f57ea65f95d55a0b80271fb7f7bfb5b39e7c028c6
7
- data.tar.gz: 816dfd630425a25b40e283737fe0d8f26483c57620cdbc2d5d23f564b177f1c8f7132152385841f7b6942570b0c75b264b41c7237cba711f1c50df8bd3525164
6
+ metadata.gz: 01b7cba09c00b595ae355263a8144dbb59e2e66ae6e417d9e027623b84429ea6de16d674a7117736fdf38ddc0c53fcc8627573b2ee468da7b6bf474f9b9d9032
7
+ data.tar.gz: 061e2ad7c3227f74bb0c7617035d8b55a4d85d9ecdc66a85ab2b81afecd13afb9366e480643042511aa6efdf580031295551617c21f4754b77b4eaf8b406aa84
@@ -1,7 +1,7 @@
1
1
  module GlossyApp
2
-
2
+
3
3
  class Session
4
-
4
+
5
5
  def create_file_asset(file_path, asset_folder_id)
6
6
  # won't work otherwise...
7
7
  setup_session
@@ -10,14 +10,14 @@ module GlossyApp
10
10
 
11
11
  if [200, 201].include?(response.status)
12
12
  asset_file = JSON.parse(response.body)
13
- return asset_file['id']
13
+ return asset_file['asset_file']['id']
14
14
  else
15
15
  raise "Invalid response: #{response.inspect}\n#{response.body}"
16
16
  end
17
-
17
+
18
18
  return nil
19
19
  end
20
-
20
+
21
21
  def delete_file_asset(asset_folder_id, asset_file_id)
22
22
  response = @glossy_api.delete("/asset_folders/#{asset_folder_id}/asset_files/#{asset_file_id}")
23
23
  if [200, 201].include?(response.status)
@@ -26,7 +26,7 @@ module GlossyApp
26
26
  raise "Invalid response: #{response.inspect}\n#{response.body}"
27
27
  end
28
28
  end
29
-
29
+
30
30
  def create_assets_folder(name, parent_id = 'root')
31
31
  data = {
32
32
  'asset_folder' => {
@@ -38,12 +38,12 @@ module GlossyApp
38
38
  response = @glossy_api.post('/asset_folders', data.to_json, {"Content-Type" => "application/json"})
39
39
  if [200, 201].include?(response.status)
40
40
  asset_folder = JSON.parse(response.body)
41
- return asset_folder['id']
41
+ return asset_folder['asset_folder']['id']
42
42
  else
43
43
  raise "Invalid response: #{response.inspect}\n#{response.body}"
44
44
  end
45
45
  end
46
-
46
+
47
47
  def delete_assets_folder(assets_folder_id)
48
48
  response = @glossy_api.delete("/asset_folders/#{assets_folder_id}")
49
49
  if [200, 201].include?(response.status)
@@ -52,12 +52,12 @@ module GlossyApp
52
52
  raise "Invalid response: #{response.inspect}\n#{response.body}"
53
53
  end
54
54
  end
55
-
55
+
56
56
  def asset_folder_with_name_exists?(asset_folder_name, parent_folder_id='root')
57
57
  response = @glossy_api.get "/asset_folders/#{parent_folder_id}"
58
58
  if [200].include?(response.status)
59
59
  root = JSON.parse(response.body)
60
- root['children'].each do |folder|
60
+ root['asset_folder']['children'].each do |folder|
61
61
  return folder['id'] if folder['name'] == asset_folder_name.to_s
62
62
  end
63
63
  return false
@@ -65,7 +65,7 @@ module GlossyApp
65
65
  return false
66
66
  end
67
67
  end
68
-
68
+
69
69
  end
70
-
71
- end
70
+
71
+ end
@@ -1,12 +1,12 @@
1
1
  module GlossyApp
2
-
2
+
3
3
  class Session
4
-
4
+
5
5
  def get_document_with_external_id(external_id)
6
6
  response = @glossy_api.get "/documents"
7
7
  if [200].include?(response.status)
8
8
  json = JSON.parse(response.body)
9
-
9
+
10
10
  document_id = nil
11
11
  json['documents'].each do |document|
12
12
  if document['external_id'].to_s == external_id.to_s
@@ -14,7 +14,7 @@ module GlossyApp
14
14
  break
15
15
  end
16
16
  end
17
-
17
+
18
18
  if document_id
19
19
  return get_document(document_id)
20
20
  else
@@ -23,9 +23,9 @@ module GlossyApp
23
23
  else
24
24
  raise "Invalid response: #{response.inspect}\n#{response.body}"
25
25
  end
26
-
26
+
27
27
  end
28
-
28
+
29
29
  def get_document(document_id)
30
30
  response = @glossy_api.get "/documents/#{document_id}"
31
31
  if [200].include?(response.status)
@@ -34,7 +34,7 @@ module GlossyApp
34
34
  raise "Invalid response: #{response.inspect}\n#{response.body}"
35
35
  end
36
36
  end
37
-
37
+
38
38
  def create_document(publication_id, title, language = "en", external_id = nil, tag_list = [])
39
39
  post_data = {
40
40
  'document' => {
@@ -45,19 +45,19 @@ module GlossyApp
45
45
  'tag_list' => tag_list
46
46
  }
47
47
  }
48
-
48
+
49
49
  response = @glossy_api.post("/documents", post_data.to_json, {"Content-Type" => "application/json"})
50
50
  if [200, 201].include?(response.status)
51
51
  document = JSON.parse(response.body)
52
-
53
- document_id = document['id']
52
+
53
+ document_id = document['document']['id']
54
54
  return document_id
55
-
55
+
56
56
  else
57
57
  raise "Invalid response: #{response.inspect}\n#{response.body}"
58
58
  end
59
59
  end
60
-
60
+
61
61
  def delete_document(document_id)
62
62
  response = @glossy_api.delete("/documents/#{document_id}")
63
63
  if [200, 201].include?(response.status)
@@ -66,7 +66,7 @@ module GlossyApp
66
66
  raise "Invalid response: #{response.inspect}\n#{response.body}"
67
67
  end
68
68
  end
69
-
69
+
70
70
  def document_exists?(document_id)
71
71
  response = @glossy_api.get "/documents/#{document_id}"
72
72
  if [200].include?(response.status)
@@ -76,7 +76,7 @@ module GlossyApp
76
76
  return false
77
77
  end
78
78
  end
79
-
79
+
80
80
  def publish_document(document_id)
81
81
  response = @glossy_api.post("/documents/#{document_id}/publish", {})
82
82
  if [200, 201].include?(response.status)
@@ -85,7 +85,7 @@ module GlossyApp
85
85
  raise "Invalid response: #{response.inspect}\n#{response.body}"
86
86
  end
87
87
  end
88
-
88
+
89
89
  def unpublish_document(document_id)
90
90
  response = @glossy_api.post("/documents/#{document_id}/unpublish", {})
91
91
  if [200, 201].include?(response.status)
@@ -94,7 +94,7 @@ module GlossyApp
94
94
  raise "Invalid response: #{response.inspect}\n#{response.body}"
95
95
  end
96
96
  end
97
-
97
+
98
98
  def import_asset_file_into_document(document_id, asset_file_id)
99
99
  response = @glossy_api.post("/documents/#{document_id}/import", {:asset_file_id => asset_file_id}.to_json, {"Content-Type" => "application/json"})
100
100
  if [200, 201].include?(response.status)
@@ -103,7 +103,7 @@ module GlossyApp
103
103
  raise "Invalid response: #{response.inspect}\n#{response.body}"
104
104
  end
105
105
  end
106
-
106
+
107
107
  end
108
-
109
- end
108
+
109
+ end
@@ -1,5 +1,5 @@
1
1
  module GlossyApp
2
-
2
+
3
3
  class Session
4
4
 
5
5
  def create_page_element(document_id, page_id, x, y, width, height, type, data, title = nil)
@@ -18,12 +18,12 @@ module GlossyApp
18
18
  response = @glossy_api.post("/documents/#{document_id}/pages/#{page_id}/page_elements", data.to_json, {"Content-Type" => "application/json"})
19
19
  if [200, 201].include?(response.status)
20
20
  json = JSON.parse(response.body)
21
- return json['id']
21
+ return json['page_element']['id']
22
22
  else
23
23
  raise "Invalid response: #{response.inspect}\n#{response.body}"
24
24
  end
25
25
  end
26
-
26
+
27
27
  def delete_page_element(document_id, page_id, page_element_id)
28
28
  response = @glossy_api.delete "/documents/#{document_id}/pages/#{page_id}/page_elements/#{page_element_id}"
29
29
  if [200].include?(response.status)
@@ -32,8 +32,8 @@ module GlossyApp
32
32
  raise "Invalid response: #{response.inspect}\n#{response.body}"
33
33
  end
34
34
  end
35
-
36
-
35
+
36
+
37
37
  end
38
-
39
- end
38
+
39
+ end
@@ -1,3 +1,3 @@
1
1
  module GlossyApp
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glossyapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Schmid
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-22 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler