cxf 0.0.1

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.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +12 -0
  3. data/README.md +395 -0
  4. data/lib/client.rb +447 -0
  5. data/lib/contact/config/config.rb +4 -0
  6. data/lib/contact/content/content.rb +4 -0
  7. data/lib/contact/ecommerce/ecommerce.rb +4 -0
  8. data/lib/contact.rb +284 -0
  9. data/lib/cxf/controllers/admin_base_controller.rb +17 -0
  10. data/lib/cxf/controllers/base_api_controller.rb +28 -0
  11. data/lib/cxf/controllers/base_controller.rb +54 -0
  12. data/lib/cxf/controllers/concerns/cxf_clients.rb +104 -0
  13. data/lib/cxf/controllers/concerns/read_config_file.rb +30 -0
  14. data/lib/cxf/controllers/contact_api_controller.rb +17 -0
  15. data/lib/cxf/controllers/public_api_controller.rb +14 -0
  16. data/lib/cxf/controllers/user_api_controller.rb +16 -0
  17. data/lib/cxf/helpers/contact_auth_helper.rb +86 -0
  18. data/lib/cxf/helpers/cxf_helper.rb +52 -0
  19. data/lib/cxf/helpers/proxy_controllers_methods.rb +144 -0
  20. data/lib/cxf/helpers/threads_helper.rb +109 -0
  21. data/lib/cxf/helpers/user_auth_helper.rb +74 -0
  22. data/lib/cxf.rb +15 -0
  23. data/lib/errors.rb +109 -0
  24. data/lib/generators/cxf_assets_controller.rb +7 -0
  25. data/lib/generators/cxf_config.yml.erb +27 -0
  26. data/lib/generators/cxf_contact_controller.rb +7 -0
  27. data/lib/generators/cxf_files_generator.rb +28 -0
  28. data/lib/generators/cxf_public_controller.rb +7 -0
  29. data/lib/generators/cxf_user_controller.rb +7 -0
  30. data/lib/pub/config/config.rb +6 -0
  31. data/lib/pub/content/assets.rb +16 -0
  32. data/lib/pub/content/content.rb +9 -0
  33. data/lib/pub/ecommerce/ecommerce.rb +6 -0
  34. data/lib/pub.rb +163 -0
  35. data/lib/user/config/attribute_groups.rb +79 -0
  36. data/lib/user/config/attributes.rb +88 -0
  37. data/lib/user/config/calendars.rb +91 -0
  38. data/lib/user/config/config.rb +23 -0
  39. data/lib/user/config/relationships.rb +141 -0
  40. data/lib/user/config/seeds.rb +55 -0
  41. data/lib/user/config/system_settings.rb +54 -0
  42. data/lib/user/config/tags.rb +61 -0
  43. data/lib/user/config/taxonomies.rb +120 -0
  44. data/lib/user/config/users.rb +77 -0
  45. data/lib/user/config/views.rb +68 -0
  46. data/lib/user/contacts/contacts.rb +22 -0
  47. data/lib/user/content/assets.rb +294 -0
  48. data/lib/user/content/block_templates.rb +72 -0
  49. data/lib/user/content/blocks.rb +109 -0
  50. data/lib/user/content/content.rb +174 -0
  51. data/lib/user/content/instances.rb +121 -0
  52. data/lib/user/content/print_versions.rb +129 -0
  53. data/lib/user/content/stories.rb +110 -0
  54. data/lib/user/content/story_templates.rb +97 -0
  55. data/lib/user/content/templates.rb +72 -0
  56. data/lib/user/crm/companies.rb +111 -0
  57. data/lib/user/crm/contacts.rb +294 -0
  58. data/lib/user/crm/crm.rb +9 -0
  59. data/lib/user/ecommerce/ecommerce.rb +29 -0
  60. data/lib/user/ecommerce/item_prices.rb +89 -0
  61. data/lib/user/ecommerce/locations.rb +171 -0
  62. data/lib/user/ecommerce/price_lists.rb +75 -0
  63. data/lib/user/ecommerce/product_templates.rb +106 -0
  64. data/lib/user/ecommerce/product_variations.rb +133 -0
  65. data/lib/user/ecommerce/product_versions.rb +107 -0
  66. data/lib/user/ecommerce/products.rb +156 -0
  67. data/lib/user/ecommerce/skus.rb +90 -0
  68. data/lib/user/ecommerce/taxes.rb +84 -0
  69. data/lib/user/ecommerce/variant_options.rb +71 -0
  70. data/lib/user/ecommerce/variant_values.rb +74 -0
  71. data/lib/user/ecommerce/vouchers.rb +90 -0
  72. data/lib/user/helpers/helpers.rb +116 -0
  73. data/lib/user/helpers/object_activities.rb +85 -0
  74. data/lib/user/helpers/object_folders.rb +84 -0
  75. data/lib/user/helpers/user_folders.rb +85 -0
  76. data/lib/user/marketing/marketing.rb +123 -0
  77. data/lib/user/profile/profile.rb +104 -0
  78. data/lib/user.rb +98 -0
  79. metadata +227 -0
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+ module Blocks
3
+ # === Duplicate block.
4
+ # Duplicate a block.
5
+ #
6
+ # ==== Parameters
7
+ # id:: (Integer) -- block id.
8
+ # data:: (Hash) -- Data to be submitted.
9
+ #
10
+ # ==== Example
11
+ # data = { options: [] }
12
+ # @data = @cxf_user.duplicate_block(1, data.to_json)
13
+ def duplicate_block(id, data)
14
+ @client.raw('post', "/content/blocks/#{id}/duplicate", nil, data)
15
+ end
16
+
17
+ # === Get blocks.
18
+ # Get a collection of blocks.
19
+ #
20
+ # ==== Parameters
21
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
22
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
23
+ #
24
+ # ==== First Example
25
+ # @data = @cxf_user.get_blocks
26
+ #
27
+ # ==== Second Example
28
+ # options = {
29
+ # fields: 'id, slug'
30
+ # }
31
+ # @data = @cxf_user.get_blocks(options)
32
+ #
33
+ # ==== Third Example
34
+ # options = {
35
+ # fields: 'id, slug'
36
+ # }
37
+ # @data = @cxf_user.get_blocks(options, true)
38
+ def get_blocks(options = nil, use_post = true)
39
+ get_query_results('/content/blocks', options, use_post)
40
+ end
41
+
42
+ # === Get block.
43
+ # Get a block info.
44
+ #
45
+ # ==== Parameters
46
+ # id:: (Integer) -- block id.
47
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
48
+ #
49
+ # ==== First Example
50
+ # @data = @cxf_user.get_block(1)
51
+ #
52
+ # ==== Second Example
53
+ # options = {
54
+ # fields: 'id, slug'
55
+ # }
56
+ # @data = @cxf_user.get_block(1, options)
57
+ def get_block(id, options = nil)
58
+ @client.raw('get', "/content/blocks/#{id}", options)
59
+ end
60
+
61
+ # === Create block.
62
+ # Create a block with data.
63
+ #
64
+ # ==== Parameters
65
+ # data:: (Hash) -- Data to be submitted.
66
+ #
67
+ # ==== Example
68
+ # data = {
69
+ # user_id: 1,
70
+ # slug: "new-block",
71
+ # block_template_id: 1
72
+ # }
73
+ #
74
+ # options = { fields: 'id,slug' }
75
+ #
76
+ # @data = @cxf_user.create_block(data, options)
77
+ def create_block(data, options = nil)
78
+ @client.raw('post', '/content/blocks', options, data_transform(data))
79
+ end
80
+
81
+ # === Update block.
82
+ # Update a block info.
83
+ #
84
+ # ==== Parameters
85
+ # id:: (Integer) -- block id.
86
+ # data:: (Hash) -- Data to be submitted.
87
+ #
88
+ # ==== Example
89
+ # data = {
90
+ # user_id: 1,
91
+ # slug: 'new-block'
92
+ # }
93
+ # @data = @cxf_user.update_block(5, data)
94
+ def update_block(id, data, options = nil)
95
+ @client.raw('put', "/content/blocks/#{id}", options, data_transform(data))
96
+ end
97
+
98
+ # === Delete block.
99
+ # Delete a block.
100
+ #
101
+ # ==== Parameters
102
+ # id:: (Integer) -- block id.
103
+ #
104
+ # ==== Example
105
+ # @data = @cxf_user.delete_block(6)
106
+ def delete_block(id)
107
+ @client.raw('delete', "/content/blocks/#{id}")
108
+ end
109
+ end
@@ -0,0 +1,174 @@
1
+ # frozen_string_literal: true
2
+ require_relative './assets'
3
+ require_relative './stories'
4
+ require_relative './print_versions'
5
+ require_relative './story_templates'
6
+ require_relative './blocks'
7
+ require_relative './block_templates'
8
+ require_relative './instances'
9
+ require_relative './templates'
10
+
11
+ module Content
12
+ include Assets
13
+ include Stories
14
+ include PrintVersions
15
+ include StoryTemplates
16
+ include Blocks
17
+ include BlockTemplates
18
+ include Instances
19
+ include Templates
20
+
21
+ # === Get public images url.
22
+ # Get public images url.
23
+ #
24
+ # ==== Example
25
+ # @data = @cxf_user.get_public_images_url
26
+ def get_public_images_url
27
+ @client.raw('get', '/content/public-images-url')
28
+ end
29
+
30
+ ##
31
+ # == Keywords
32
+ #
33
+
34
+ # === Get keywords.
35
+ # Get a collection of keywords.
36
+ #
37
+ # ==== Parameters
38
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
39
+ #
40
+ # ==== First Example
41
+ # @data = @cxf_user.get_keywords
42
+ #
43
+ # ==== Second Example
44
+ # options = { fields: 'title' }
45
+ # @data = @cxf_user.get_keywords(options)
46
+ def get_keywords(options = nil)
47
+ @client.raw('get', '/content/keywords', options)
48
+ end
49
+
50
+ # === Get keyword.
51
+ # Get a keyword.
52
+ #
53
+ # ==== Parameters
54
+ # id:: (Integer) -- Keyword id.
55
+ #
56
+ def get_keyword(id)
57
+ @client.raw('get', "/content/keywords/#{id}")
58
+ end
59
+
60
+ # === Create keyword.
61
+ # Create a keyword with data.
62
+ #
63
+ # ==== Parameters
64
+ # data:: (Hash) -- Data to be submitted.
65
+ #
66
+ # ==== Example
67
+ # data = {
68
+ # title: 'New Keyword'
69
+ # }
70
+ # @data = @cxf_user.create_keyword(data.to_json)
71
+ def create_keyword(data)
72
+ @client.raw('post', '/content/keywords', nil, data)
73
+ end
74
+
75
+ # === Update keyword.
76
+ # Update a keyword info.
77
+ #
78
+ # ==== Parameters
79
+ # id:: (Integer) -- Keyword id.
80
+ # data:: (Hash) -- Data to be submitted.
81
+ #
82
+ # ==== Example
83
+ #
84
+ def update_keyword(id, data)
85
+ # FIXME: Keyword controller doesnt receive data
86
+ @client.raw('put', "/content/keywords/#{id}", nil, data)
87
+ end
88
+
89
+ ##
90
+ # == Stages
91
+ #
92
+
93
+ # === Get stages.
94
+ # Get a collection of stages.
95
+ #
96
+ # ==== Parameters
97
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
98
+ #
99
+ # ==== First Example
100
+ # @data = @cxf_user.get_stages
101
+ #
102
+ # ==== Second Example
103
+ # options = { fields: 'title' }
104
+ # @data = @cxf_user.get_stages(options)
105
+ def get_stages(options = nil)
106
+ @client.raw('get', '/content/stages', options)
107
+ end
108
+
109
+ # === Get stage.
110
+ # Get a stage.
111
+ #
112
+ # ==== Parameters
113
+ # id:: (Integer) -- Stage id.
114
+ #
115
+ # ==== Example
116
+ # @data = @cxf_user.get_stage(1)
117
+ def get_stage(id)
118
+ @client.raw('get', "/content/stages/#{id}")
119
+ end
120
+
121
+ # === Create stage.
122
+ # Create a stage with data.
123
+ #
124
+ # ==== Parameters
125
+ # data:: (Hash) -- Data to be submitted.
126
+ #
127
+ # ==== Example
128
+ # config_json = {
129
+ # count: 1
130
+ # }
131
+ # event_json = {
132
+ # rset: 'DTSTART:20190214T000000Z',
133
+ # duration: 1
134
+ # }
135
+ # data = {
136
+ # title: 'New Stage',
137
+ # description: 'New Stage Description',
138
+ # config_json: config_json.to_json,
139
+ # event_json: event_json.to_json
140
+ # }
141
+ # @data = @cxf_user.create_stage(data.to_json)
142
+ def create_stage(data)
143
+ @client.raw('post', '/content/stages', nil, data)
144
+ end
145
+
146
+ # === Update stage.
147
+ # Update a stage info.
148
+ #
149
+ # ==== Parameters
150
+ # id:: (Integer) -- Stage id.
151
+ # data:: (Hash) -- Data to be submitted.
152
+ #
153
+ # ==== Example
154
+ # config_json = {
155
+ # count: 2
156
+ # }
157
+ # event_json = {
158
+ # rset: 'DTSTART:20190214T000000Z',
159
+ # duration: 2
160
+ # }
161
+ # data = {
162
+ # stageProps: {
163
+ # title: 'New Stage Modified',
164
+ # description: 'New Stage Description Modified'
165
+ # },
166
+ # config_json: config_json.to_json,
167
+ # event_json: event_json.to_json
168
+ # }
169
+ # @data = @cxf_user.update_stage(3, data.to_json)
170
+ def update_stage(id, data)
171
+ # TODO: Inform StageController.update method has been modified
172
+ @client.raw('put', "/content/stages/#{id}", nil, data)
173
+ end
174
+ end
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Instances
4
+ # === Duplicate instance.
5
+ # Duplicate a instance.
6
+ #
7
+ # ==== Parameters
8
+ # id:: (Integer) -- instance id.
9
+ # data:: (Hash) -- Data to be submitted.
10
+ #
11
+ # ==== Example
12
+ # data = { options: [] }
13
+ # @data = @cxf_user.duplicate_instance(1, data.to_json)
14
+ def duplicate_instance(id, data)
15
+ @client.raw('post', "/content/instances/#{id}/duplicate", nil, data)
16
+ end
17
+
18
+ # === Get instances.
19
+ # Get a collection of instances.
20
+ #
21
+ # ==== Parameters
22
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
23
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
24
+ #
25
+ # ==== First Example
26
+ # @data = @cxf_user.get_instances
27
+ #
28
+ # ==== Second Example
29
+ # options = {
30
+ # fields: 'id, slug'
31
+ # }
32
+ # @data = @cxf_user.get_instances(options)
33
+ #
34
+ # ==== Third Example
35
+ # options = {
36
+ # fields: 'id, slug'
37
+ # }
38
+ # @data = @cxf_user.get_instances(options, true)
39
+ def get_instances(options = nil, use_post = true)
40
+ get_query_results('/content/instances', options, use_post)
41
+ end
42
+
43
+ # === Get instance.
44
+ # Get a instance info.
45
+ #
46
+ # ==== Parameters
47
+ # id:: (Integer) -- instance id.
48
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
49
+ #
50
+ # ==== First Example
51
+ # @data = @cxf_user.get_instance(1)
52
+ #
53
+ # ==== Second Example
54
+ # options = {
55
+ # fields: 'id, slug'
56
+ # }
57
+ # @data = @cxf_user.get_instance(1, options)
58
+ def get_instance(id, options = nil)
59
+ @client.raw('get', "/content/instances/#{id}", options)
60
+ end
61
+
62
+ # === Create instance.
63
+ # Create a instance with data.
64
+ #
65
+ # ==== Parameters
66
+ # data:: (Hash) -- Data to be submitted.
67
+ #
68
+ # ==== Example
69
+ # data = {
70
+ # user_id: 1,
71
+ # slug: "new-instance",
72
+ # instance_template_id: 1
73
+ # }
74
+ #
75
+ # options = { fields: 'id,slug' }
76
+ #
77
+ # @data = @cxf_user.create_instance(data, options)
78
+ def create_instance(data, options = nil)
79
+ @client.raw('post', '/content/instances', options, data_transform(data))
80
+ end
81
+
82
+ # === Create instance version.
83
+ # Create a instance version with data.
84
+ #
85
+ # ==== Parameters
86
+ # id:: (Integer) -- instance id.
87
+ # data:: (Hash) -- Data to be submitted.
88
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
89
+ def create_instance_version(id, data, options = nil)
90
+ @client.raw('post', "/content/instances/#{id}/print-version", options, data_transform(data))
91
+ end
92
+
93
+ # === Update instance.
94
+ # Update a instance info.
95
+ #
96
+ # ==== Parameters
97
+ # id:: (Integer) -- instance id.
98
+ # data:: (Hash) -- Data to be submitted.
99
+ #
100
+ # ==== Example
101
+ # data = {
102
+ # user_id: 1,
103
+ # slug: 'new-instance'
104
+ # }
105
+ # @data = @cxf_user.update_instance(5, data)
106
+ def update_instance(id, data, options = nil)
107
+ @client.raw('put', "/content/instances/#{id}", options, data_transform(data))
108
+ end
109
+
110
+ # === Delete instance.
111
+ # Delete a instance.
112
+ #
113
+ # ==== Parameters
114
+ # id:: (Integer) -- instance id.
115
+ #
116
+ # ==== Example
117
+ # @data = @cxf_user.delete_instance(6)
118
+ def delete_instance(id)
119
+ @client.raw('delete', "/content/instances/#{id}")
120
+ end
121
+ end
@@ -0,0 +1,129 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrintVersions
4
+ # === Get print versions.
5
+ # Get a collection of print versions.
6
+ #
7
+ # ==== Parameters
8
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
9
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
10
+ #
11
+ # ==== First Example
12
+ # @data = @cxf_user.get_print_versions
13
+ #
14
+ # ==== Second Example
15
+ # options = {
16
+ # fields: 'id, title'
17
+ # }
18
+ # @data = @cxf_user.get_print_versions(options)
19
+ #
20
+ # ==== Third Example
21
+ # options = {
22
+ # fields: 'id, title'
23
+ # }
24
+ # @data = @cxf_user.get_print_versions(options, true)
25
+ def get_print_versions(options = nil, use_post = true)
26
+ get_query_results('/content/print-versions', options, use_post)
27
+ end
28
+
29
+ # === Get print version.
30
+ # Get a print version info.
31
+ #
32
+ # ==== Parameters
33
+ # id:: (Integer) -- print version id.
34
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
35
+ #
36
+ # ==== First Example
37
+ # @data = @cxf_user.get_print_version(1)
38
+ #
39
+ # ==== Second Example
40
+ # options = {
41
+ # fields: 'id, title'
42
+ # }
43
+ # @data = @cxf_user.get_print_version(1, options)
44
+ def get_print_version(id, options = nil)
45
+ @client.raw('get', "/content/print-versions/#{id}", options)
46
+ end
47
+
48
+ # === Create print version.
49
+ # Create a print version with data.
50
+ #
51
+ # ==== Parameters
52
+ # data:: (Hash) -- Data to be submitted.
53
+ #
54
+ # ==== Example
55
+ # data = {
56
+ # title: 'New print',
57
+ # slug: 'new-print',
58
+ # social_metadata: 'social metadata'
59
+ # }
60
+ # @data = @cxf_user.create_print_version(data)
61
+ def create_print_version(data, options = nil)
62
+ @client.raw('post', '/content/print-versions', options, data_transform(data))
63
+ end
64
+
65
+ # === CHECK THIS ===
66
+ # def create_print_version_from_instance(id, data, options = nil)
67
+ # @client.raw('post', "/content/print-versions/#{id}/print-version", options, data_transform(data))
68
+ # end
69
+
70
+ # === Update print version.
71
+ # Update a print version info.
72
+ #
73
+ # ==== Parameters
74
+ # id:: (Integer) -- print version id.
75
+ # data:: (Hash) -- Data to be submitted.
76
+ #
77
+ # ==== Example
78
+ # data = {
79
+ # title: 'New print Modified',
80
+ # slug: 'new-print'
81
+ # }
82
+ # @data = @cxf_user.update_print_version(5, data)
83
+ def update_print_version(id, data, options = nil)
84
+ @client.raw('put', "/content/print-versions/#{id}", options, data_transform(data))
85
+ end
86
+
87
+ # === Delete print version.
88
+ # Delete a print version.
89
+ #
90
+ # ==== Parameters
91
+ # id:: (Integer) -- print version id.
92
+ #
93
+ # ==== Example
94
+ # @data = @cxf_user.delete_print_version(6)
95
+ def delete_print_version(id)
96
+ @client.raw('delete', "/content/print-versions/#{id}")
97
+ end
98
+
99
+ # === Duplicate print version.
100
+ # Duplicate a print version.
101
+ #
102
+ # ==== Parameters
103
+ # id:: (Integer) -- print version id.
104
+ # data:: (Hash) -- Data to be submitted.
105
+ #
106
+ # ==== Example
107
+ # data = { options: [] }
108
+ # @data = @cxf_user.duplicate_print_version(1, data.to_json)
109
+ def duplicate_print_version(id, data)
110
+ @client.raw('post', "/content/print-versions/#{id}/duplicate", nil, data)
111
+ end
112
+
113
+ # === Publish print version.
114
+ # Publish a print version.
115
+ #
116
+ # ==== Parameters
117
+ # id:: (Integer) -- print version id.
118
+ # data:: (Hash) -- Data to be submitted.
119
+ #
120
+ # ==== Example
121
+ # data = {
122
+ # title: 'New print Modified',
123
+ # slug: 'new-print'
124
+ # }
125
+ # @data = @cxf_user.publish_print_version(1, data.to_json)
126
+ def publish_print_version(id, data)
127
+ @client.raw('put', "/content/print-versions/#{id}/publish", nil, data)
128
+ end
129
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stories
4
+ # === Duplicate story.
5
+ # Duplicate a story.
6
+ #
7
+ # ==== Parameters
8
+ # id:: (Integer) -- Story id.
9
+ # data:: (Hash) -- Data to be submitted.
10
+ #
11
+ # ==== Example
12
+ # data = { options: [] }
13
+ # @data = @cxf_user.duplicate_story(1, data.to_json)
14
+ def duplicate_story(id, data)
15
+ @client.raw('post', "/content/stories/#{id}/duplicate", nil, data)
16
+ end
17
+
18
+ # === Get stories.
19
+ # Get a collection of stories.
20
+ #
21
+ # ==== Parameters
22
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
23
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
24
+ #
25
+ # ==== First Example
26
+ # @data = @cxf_user.get_stories
27
+ #
28
+ # ==== Second Example
29
+ # options = {
30
+ # fields: 'id, slug'
31
+ # }
32
+ # @data = @cxf_user.get_stories(options)
33
+ #
34
+ # ==== Third Example
35
+ # options = {
36
+ # fields: 'id, slug'
37
+ # }
38
+ # @data = @cxf_user.get_stories(options, true)
39
+ def get_stories(options = nil, use_post = true)
40
+ get_query_results('/content/stories', options, use_post)
41
+ end
42
+
43
+ # === Get story.
44
+ # Get a story info.
45
+ #
46
+ # ==== Parameters
47
+ # id:: (Integer) -- Story id.
48
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
49
+ #
50
+ # ==== First Example
51
+ # @data = @cxf_user.get_story(1)
52
+ #
53
+ # ==== Second Example
54
+ # options = {
55
+ # fields: 'id, slug'
56
+ # }
57
+ # @data = @cxf_user.get_story(1, options)
58
+ def get_story(id, options = nil)
59
+ @client.raw('get', "/content/stories/#{id}", options)
60
+ end
61
+
62
+ # === Create story.
63
+ # Create a story with data.
64
+ #
65
+ # ==== Parameters
66
+ # data:: (Hash) -- Data to be submitted.
67
+ #
68
+ # ==== Example
69
+ # data = {
70
+ # user_id: 1,
71
+ # slug: "new-story",
72
+ # story_template_id: 1
73
+ # }
74
+ #
75
+ # options = { fields: 'id,slug' }
76
+ #
77
+ # @data = @cxf_user.create_story(data, options)
78
+ def create_story(data, options = nil)
79
+ @client.raw('post', '/content/stories', options, data_transform(data))
80
+ end
81
+
82
+ # === Update story.
83
+ # Update a story info.
84
+ #
85
+ # ==== Parameters
86
+ # id:: (Integer) -- Story id.
87
+ # data:: (Hash) -- Data to be submitted.
88
+ #
89
+ # ==== Example
90
+ # data = {
91
+ # user_id: 1,
92
+ # slug: 'new-story'
93
+ # }
94
+ # @data = @cxf_user.update_story(5, data)
95
+ def update_story(id, data, options = nil)
96
+ @client.raw('put', "/content/stories/#{id}", options, data_transform(data))
97
+ end
98
+
99
+ # === Delete story.
100
+ # Delete a story.
101
+ #
102
+ # ==== Parameters
103
+ # id:: (Integer) -- Story id.
104
+ #
105
+ # ==== Example
106
+ # @data = @cxf_user.delete_story(6)
107
+ def delete_story(id)
108
+ @client.raw('delete', "/content/stories/#{id}")
109
+ end
110
+ end