Class: Karaden::Param::Message::MessageCreateParams
- Inherits:
-
MessageParams
- Object
- MessageParams
- Karaden::Param::Message::MessageCreateParams
- Defined in:
- lib/karaden/param/message/message_create_params.rb
Constant Summary
Constants inherited from MessageParams
Karaden::Param::Message::MessageParams::CONTEXT_PATH
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#is_shorten ⇒ Object
Returns the value of attribute is_shorten.
-
#limited_at ⇒ Object
Returns the value of attribute limited_at.
-
#scheduled_at ⇒ Object
Returns the value of attribute scheduled_at.
-
#service_id ⇒ Object
Returns the value of attribute service_id.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#to ⇒ Object
Returns the value of attribute to.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ MessageCreateParams
constructor
A new instance of MessageCreateParams.
- #to_data ⇒ Object
- #to_path ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize ⇒ MessageCreateParams
Returns a new instance of MessageCreateParams.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/karaden/param/message/message_create_params.rb', line 7 def initialize() @service_id = nil @to = nil @body = nil @tags = nil @is_shorten = nil @scheduled_at = nil @limited_at = nil super end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/karaden/param/message/message_create_params.rb', line 5 def body @body end |
#is_shorten ⇒ Object
Returns the value of attribute is_shorten.
5 6 7 |
# File 'lib/karaden/param/message/message_create_params.rb', line 5 def is_shorten @is_shorten end |
#limited_at ⇒ Object
Returns the value of attribute limited_at.
5 6 7 |
# File 'lib/karaden/param/message/message_create_params.rb', line 5 def limited_at @limited_at end |
#scheduled_at ⇒ Object
Returns the value of attribute scheduled_at.
5 6 7 |
# File 'lib/karaden/param/message/message_create_params.rb', line 5 def scheduled_at @scheduled_at end |
#service_id ⇒ Object
Returns the value of attribute service_id.
5 6 7 |
# File 'lib/karaden/param/message/message_create_params.rb', line 5 def service_id @service_id end |
#tags ⇒ Object
Returns the value of attribute tags.
5 6 7 |
# File 'lib/karaden/param/message/message_create_params.rb', line 5 def @tags end |
#to ⇒ Object
Returns the value of attribute to.
5 6 7 |
# File 'lib/karaden/param/message/message_create_params.rb', line 5 def to @to end |
Class Method Details
.new_builder ⇒ Object
72 73 74 |
# File 'lib/karaden/param/message/message_create_params.rb', line 72 def self.new_builder MessageCreateParamsBuilder.new end |
Instance Method Details
#to_data ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/karaden/param/message/message_create_params.rb', line 22 def to_data { service_id: @service_id, to: @to, body: @body, 'tags[]' => @tags, is_shorten: if @is_shorten.nil? nil else @is_shorten ? 'true' : 'false' end, scheduled_at: @scheduled_at&.iso8601, limited_at: @limited_at&.iso8601 }.reject { |_, value| value.nil? } end |
#to_path ⇒ Object
18 19 20 |
# File 'lib/karaden/param/message/message_create_params.rb', line 18 def to_path CONTEXT_PATH end |
#validate ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/karaden/param/message/message_create_params.rb', line 38 def validate errors = Karaden::Model::KaradenObject.new has_error = false = validate_service_id unless .empty? errors.set_property('service_id', ) has_error = true end = validate_to unless .empty? errors.set_property('to', ) has_error = true end = validate_body unless .empty? errors.set_property('body', ) has_error = true end if has_error e = Karaden::Exception::InvalidParamsException.new error = Karaden::Model::Error.new error.set_property('object', Karaden::Model::Error::OBJECT_NAME) error.set_property('errors', errors) e.error = error raise e end self end |