Class: Proz::WiwoReply

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/proz/wiwo_reply.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token:, id:, message:, **options) ⇒ WiwoReply

Returns a new instance of WiwoReply.



8
9
10
11
12
13
# File 'lib/proz/wiwo_reply.rb', line 8

def initialize(token:, id:, message:, **options)
  @token = token
  @id = id
  @message = { message: message }
  @options = options
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/proz/wiwo_reply.rb', line 7

def id
  @id
end

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/proz/wiwo_reply.rb', line 7

def message
  @message
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/proz/wiwo_reply.rb', line 7

def options
  @options
end

#tokenObject (readonly)

Returns the value of attribute token.



7
8
9
# File 'lib/proz/wiwo_reply.rb', line 7

def token
  @token
end

Instance Method Details

#postObject



15
16
17
18
19
20
# File 'lib/proz/wiwo_reply.rb', line 15

def post
  body = message.merge!(options)
  self.class.post("/wiwo/#{id}/replies",
    body: body,
    headers: { 'Authorization' => "Bearer #{token}" } )
end