Class: BeeiqAPI::Ticket
- Inherits:
-
Object
- Object
- BeeiqAPI::Ticket
- Defined in:
- lib/beeiq_api/ticket.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#contact_id ⇒ Object
Returns the value of attribute contact_id.
-
#contact_type ⇒ Object
Returns the value of attribute contact_type.
-
#email ⇒ Object
Returns the value of attribute email.
-
#group_name ⇒ Object
Returns the value of attribute group_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#passport ⇒ Object
Returns the value of attribute passport.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#sla_name ⇒ Object
Returns the value of attribute sla_name.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Ticket
constructor
A new instance of Ticket.
- #payload ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Ticket
Returns a new instance of Ticket.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/beeiq_api/ticket.rb', line 16 def initialize( = {}) @contact_type = [:contact_type] || Config::ContactType::CUSTOMER @title = [:title] @body = [:body] @email = [:email] @phone = [:phone] @name = [:name] @passport = [:passport] @contact_id = [:contact_id] @group_name = [:group_name] @sla_name = [:sla_name] @channel = [:channel] @tag = [:tag] raise ArgumentError, 'body is required' if @body.to_s.empty? end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/beeiq_api/ticket.rb', line 5 def body @body end |
#channel ⇒ Object
Returns the value of attribute channel.
13 14 15 |
# File 'lib/beeiq_api/ticket.rb', line 13 def channel @channel end |
#contact_id ⇒ Object
Returns the value of attribute contact_id.
10 11 12 |
# File 'lib/beeiq_api/ticket.rb', line 10 def contact_id @contact_id end |
#contact_type ⇒ Object
Returns the value of attribute contact_type.
3 4 5 |
# File 'lib/beeiq_api/ticket.rb', line 3 def contact_type @contact_type end |
#email ⇒ Object
Returns the value of attribute email.
6 7 8 |
# File 'lib/beeiq_api/ticket.rb', line 6 def email @email end |
#group_name ⇒ Object
Returns the value of attribute group_name.
11 12 13 |
# File 'lib/beeiq_api/ticket.rb', line 11 def group_name @group_name end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/beeiq_api/ticket.rb', line 8 def name @name end |
#passport ⇒ Object
Returns the value of attribute passport.
9 10 11 |
# File 'lib/beeiq_api/ticket.rb', line 9 def passport @passport end |
#phone ⇒ Object
Returns the value of attribute phone.
7 8 9 |
# File 'lib/beeiq_api/ticket.rb', line 7 def phone @phone end |
#sla_name ⇒ Object
Returns the value of attribute sla_name.
12 13 14 |
# File 'lib/beeiq_api/ticket.rb', line 12 def sla_name @sla_name end |
#tag ⇒ Object
Returns the value of attribute tag.
14 15 16 |
# File 'lib/beeiq_api/ticket.rb', line 14 def tag @tag end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/beeiq_api/ticket.rb', line 4 def title @title end |
Instance Method Details
#payload ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/beeiq_api/ticket.rb', line 33 def payload data = { contactType: @contact_type, title: @title, body: @body.to_s.gsub("\n", '<br>'), email: @email, phone: @phone, name: @name, passport: @passport, contactId: @contact_id, groupName: @group_name, slaName: @sla_name, channel: @channel, tag: @tag } data.delete_if { |k, v| v.nil? || v.empty? } end |