Class: Bottle::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/client/rest_calls.rb,
lib/bottle_ruby.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(uid, token) ⇒ Client



13
14
15
16
# File 'lib/bottle_ruby.rb', line 13

def initialize(uid, token)
  @uid = uid
  @token = token
end

Instance Method Details

#post(url_extension, params) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/client/rest_calls.rb', line 9

def post(url_extension, params)
  connection = Faraday.new(url: API_URL) 
  response = connection.post(url_extension, params.merge({uid: self.uid, token: self.token}))
  attributes = JSON.parse(response.body)
  return Bottle::Message.new(attributes) if url_extension == 'messages'
  return Bottle::Conversation.new(attributes) if url_extension == 'conversations'
end

#requestObject



6
7
# File 'lib/client/rest_calls.rb', line 6

def request()
end

#tokenObject



22
23
24
# File 'lib/bottle_ruby.rb', line 22

def token
  @token
end

#uidObject



18
19
20
# File 'lib/bottle_ruby.rb', line 18

def uid
  @uid
end