citadel-ruby-client 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4eee5298d36847880bb589c348a9a4bfd65da06
4
- data.tar.gz: 4b5c9fd87308bc695519f69cd607dec4a5d24f4e
3
+ metadata.gz: 213ec157a282e48f010274dc726ea9a3f1b5549e
4
+ data.tar.gz: 331f77a434f450bae64535b661813706b7b172fb
5
5
  SHA512:
6
- metadata.gz: a2d6f85519efe496b7ba4724fabb30011827a55c348405c67a666296702543620d9f1a716b28e34a9ad19467cf7e4d8570332dbebe8af08d77b9e04c4f870389
7
- data.tar.gz: 9520e30a10ae1650767ab07a6bfeb9309bb895d690e78ac860ef67208d83387f78aebd78e1716a7648d5d1f2411886c52f3b160bf266a5d653530f9d8dced4a8
6
+ metadata.gz: 0e03656e5bb831d7f1596169ee9e08f6047c8ad421865c3330bc024e9f20e87a6f7450fd6f838d8d8a8f317f861a628260fdeb6270d035ba7e987e865d8acbc8
7
+ data.tar.gz: baee4d3e33432ae453baf035c1ff2791d95e8b3b6597696d4ffc4a8b915f5f49ed55c8b25c8befe8b65f87b4d4f3e30ef1cf1a35d63ee1e8fb3274787aac925e
@@ -7,7 +7,6 @@ require 'citadel-ruby-client/matrix_paths'
7
7
  require 'citadel-ruby-client/matrix_interceptor'
8
8
 
9
9
  module Citadel
10
-
11
10
  DEFAULT_PUBLIC_ROOMS_LIMIT = 100
12
11
 
13
12
  class << self
@@ -16,11 +15,11 @@ module Citadel
16
15
 
17
16
  class Client
18
17
  def initialize(tenant_url, public_rooms_limit = DEFAULT_PUBLIC_ROOMS_LIMIT)
19
- if tenant_url[-1,1] == '/'
20
- Citadel.tenant_url = tenant_url[0,tenant_url.length-1]
21
- else
22
- Citadel.tenant_url = tenant_url
23
- end
18
+ Citadel.tenant_url = if tenant_url[-1, 1] == '/'
19
+ tenant_url[0, tenant_url.length - 1]
20
+ else
21
+ tenant_url
22
+ end
24
23
  Citadel.public_rooms_limit = public_rooms_limit
25
24
  end
26
25
 
@@ -30,8 +29,9 @@ module Citadel
30
29
 
31
30
  def auth_token
32
31
  return @auth_token if defined? @auth_token
32
+
33
33
  puts 'Citadel: You need to sign in'
34
- return nil
34
+ nil
35
35
  end
36
36
 
37
37
  def sign_in(login, password)
@@ -78,13 +78,13 @@ module Citadel
78
78
  def create_room(room_name, topic)
79
79
  matrix_paths = MatrixPaths.new
80
80
  url = matrix_paths.base_uri + matrix_paths.create_room_path
81
- room_name_alias = room_name.gsub!(' ','_')
81
+ room_name_alias = room_name.tr!(' ', '_')
82
82
  data_hash = { creation_content: { 'm.federate': false },
83
83
  name: room_name,
84
84
  preset: 'public_chat',
85
85
  visibility: 'public',
86
86
  room_alias_name: room_name_alias,
87
- topic: topic}
87
+ topic: topic }
88
88
  data = JSON.generate data_hash
89
89
 
90
90
  response = HTTP.auth(auth_token).post(url, body: data)
@@ -102,7 +102,6 @@ module Citadel
102
102
  ########
103
103
 
104
104
  def send_message(room_id, message)
105
-
106
105
  matrix_paths = MatrixPaths.new
107
106
  randomizer = Random.new
108
107
  txn = randomizer.rand(100)
@@ -130,7 +129,6 @@ module Citadel
130
129
  end
131
130
 
132
131
  def invite_in_room(room_id, user_id)
133
-
134
132
  matrix_paths = MatrixPaths.new
135
133
  url = matrix_paths.base_uri + matrix_paths.invite_in_room_path(room_id)
136
134
  data_hash = { user_id: user_id }
@@ -13,4 +13,4 @@ module Citadel
13
13
  JSON.parse(response.body)['access_token']
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Citadel
4
4
  class MatrixPaths
5
-
6
5
  def base_uri
7
6
  Citadel.tenant_url + '/_matrix/client/r0'
8
7
  end
@@ -24,7 +23,7 @@ module Citadel
24
23
  end
25
24
 
26
25
  def list_public_rooms_path
27
- '/publicRooms' + '?limit=' + Citadel.public_rooms_limit
26
+ '/publicRooms' + '?limit=' + Citadel.public_rooms_limit.to_s
28
27
  end
29
28
 
30
29
  def list_joined_rooms_path
@@ -1,3 +1,3 @@
1
1
  module Citadel
2
- VERSION = "0.2.4"
2
+ VERSION = '0.2.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citadel-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claire Dufetrelle