Class: Files::Announcement
- Inherits:
-
Object
- Object
- Files::Announcement
- Defined in:
- lib/files.com/models/announcement.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.create_export(params = {}, options = {}) ⇒ Object
Parameters: sort_by - object - If set, sort records by the specified field in either
ascordescdirection. -
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
Instance Method Summary collapse
-
#body ⇒ Object
string - Announcement body.
-
#button_text ⇒ Object
string - Text to go on the CTA button.
-
#button_url ⇒ Object
string - URL to link to when CTA button is clicked.
-
#headline ⇒ Object
string - Announcement headline.
-
#html_body ⇒ Object
string - Body converted to HTML.
-
#id ⇒ Object
int64 - Announcement Id.
-
#initialize(attributes = {}, options = {}) ⇒ Announcement
constructor
A new instance of Announcement.
-
#label ⇒ Object
string - Text for a label that can be added to the announcement.
-
#label_color ⇒ Object
string - Color for label on announcement.
-
#publish_at ⇒ Object
date-time - When was this announcement published?.
-
#slug ⇒ Object
string - URL slug for announcement.
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ Announcement
Returns a new instance of Announcement.
7 8 9 10 |
# File 'lib/files.com/models/announcement.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/announcement.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/announcement.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
76 77 78 |
# File 'lib/files.com/models/announcement.rb', line 76 def self.all(params = {}, = {}) list(params, ) end |
.create_export(params = {}, options = {}) ⇒ Object
Parameters:
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
82 83 84 85 86 87 |
# File 'lib/files.com/models/announcement.rb', line 82 def self.create_export(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash) response, = Api.send_request("/announcements/create_export", :post, params, ) Export.new(response.data, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
66 67 68 69 70 71 72 73 74 |
# File 'lib/files.com/models/announcement.rb', line 66 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash) List.new(Announcement, params) do Api.send_request("/announcements", :get, params, ) end end |
Instance Method Details
#body ⇒ Object
string - Announcement body
23 24 25 |
# File 'lib/files.com/models/announcement.rb', line 23 def body @attributes[:body] end |
#button_text ⇒ Object
string - Text to go on the CTA button
28 29 30 |
# File 'lib/files.com/models/announcement.rb', line 28 def @attributes[:button_text] end |
#button_url ⇒ Object
string - URL to link to when CTA button is clicked
33 34 35 |
# File 'lib/files.com/models/announcement.rb', line 33 def @attributes[:button_url] end |
#headline ⇒ Object
string - Announcement headline
18 19 20 |
# File 'lib/files.com/models/announcement.rb', line 18 def headline @attributes[:headline] end |
#html_body ⇒ Object
string - Body converted to HTML
38 39 40 |
# File 'lib/files.com/models/announcement.rb', line 38 def html_body @attributes[:html_body] end |
#id ⇒ Object
int64 - Announcement Id
13 14 15 |
# File 'lib/files.com/models/announcement.rb', line 13 def id @attributes[:id] end |
#label ⇒ Object
string - Text for a label that can be added to the announcement
43 44 45 |
# File 'lib/files.com/models/announcement.rb', line 43 def label @attributes[:label] end |
#label_color ⇒ Object
string - Color for label on announcement
48 49 50 |
# File 'lib/files.com/models/announcement.rb', line 48 def label_color @attributes[:label_color] end |
#publish_at ⇒ Object
date-time - When was this announcement published?
53 54 55 |
# File 'lib/files.com/models/announcement.rb', line 53 def publish_at @attributes[:publish_at] end |
#slug ⇒ Object
string - URL slug for announcement
58 59 60 |
# File 'lib/files.com/models/announcement.rb', line 58 def slug @attributes[:slug] end |