Class: Warb::Resources::LocationRequest

Inherits:
Resource
  • Object
show all
Defined in:
lib/warb/resources/location_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#add_document_header, #add_image_header, #add_text_header, #add_video_header, #build_header, #build_template_named_parameter, #build_template_positional_parameter, #call, #initialize

Methods included from Validation

#blank?, #raw_value, #resolve, #validates

Constructor Details

This class inherits a constructor from Warb::Resources::Resource

Instance Attribute Details

#body_textObject

Returns the value of attribute body_text.



6
7
8
# File 'lib/warb/resources/location_request.rb', line 6

def body_text
  @body_text
end

Instance Method Details

#build_payloadObject

rubocop:disable Metrics/MethodLength



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/warb/resources/location_request.rb', line 9

def build_payload
  {
    type: 'interactive',
    interactive: {
      type: 'location_request_message',
      body: {
        text: body_text || @params[:body_text]
      },
      action: {
        name: 'send_location'
      }
    }
  }
end