selfsdk 0.0.205 → 0.0.206

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aefa2c3a38cd8b027fb2095affee9bd67b74c1e1c417ffa9e028f656a3d28e34
4
- data.tar.gz: 7969b31c5f519a2d9c4a8a098d8862119dbdf4e0aba6dfa71b39dfb7e2d2d437
3
+ metadata.gz: 04e3ca0ab456325ed10c941ecdcc1df830f5a0f4c9cf3943fd9d06bce2aef5de
4
+ data.tar.gz: d24a21a686ee1ad5181b4f3a482442dba30961b451c9fa31c2e3d2abedf6d197
5
5
  SHA512:
6
- metadata.gz: f15414f199e776fb0bf7578226c00c8f9c649940fd9ac74d40b177e50a3acca0a48204c8e638a1bf15bc5c09e35a868c60f3833bfd778e8fe13161263d25b11d
7
- data.tar.gz: 5e6f46cad290c73094aa2697b63b154a79cd1f54610c7b8051a6b8ebf14e604432fb86ba6b45884aec90ad51c54cb1545bfe5fcb04012c8e6f8160caf7afc44e
6
+ metadata.gz: 0c096d4d924486aa47c855e16487db1e41445ac0f0d7dd45b70d7b05335dcdd90b9749d039c91660fb30b1943bc996ab745f4c705c59353b9811e37646821601
7
+ data.tar.gz: 3222fecfe339e2695a72bb5ada11a8bcf121eef7ddab3134d1c38770b18bf9131bb24c89a29ca1b6b12df6faaf6e9dd6350c420336c841f4e9f1e4d2c8c9d816
data/lib/jwt_service.rb CHANGED
@@ -93,6 +93,21 @@ module SelfSDK
93
93
  "#{payload}.#{signature}"
94
94
  end
95
95
 
96
+ def build_dynamic_link(body, env, callback)
97
+ base_url = "https://#{env}.links.joinself.com"
98
+ portal_url = "https://developer.#{env}.joinself.com"
99
+ apn = "com.joinself.app.#{env}"
100
+
101
+ if env.empty? || env == 'development'
102
+ base_url = "https://links.joinself.com"
103
+ portal_url = "https://developer.joinself.com"
104
+ apn = "com.joinself.app"
105
+ end
106
+ apn = "com.joinself.app.dev" if env == 'development'
107
+
108
+ "#{base_url}?link=#{portal_url}/callback/#{callback}%3Fqr=#{body}&apn=#{apn}"
109
+ end
110
+
96
111
  private
97
112
 
98
113
  def header
data/lib/selfsdk.rb CHANGED
@@ -55,6 +55,7 @@ module SelfSDK
55
55
 
56
56
  SelfSDK.logger.debug "syncing ntp times #{SelfSDK::Time.now}"
57
57
  env = opts.fetch(:env, "")
58
+ env = "" if env == "production"
58
59
 
59
60
  @client = RestClient.new(base_url(opts), app_id, app_key, env)
60
61
  messaging_url = messaging_url(opts)
data/lib/services/auth.rb CHANGED
@@ -69,7 +69,7 @@ module SelfSDK
69
69
 
70
70
  # Generates a deep link to authenticate with self app.
71
71
  #
72
- # @param callback [String] the url you'll be redirected if the app is not installed.
72
+ # @param callback [String] the callback identifier you'll be redirected to if the app is not installed.
73
73
  # @option opts [String] :selfid the user selfid you want to authenticate.
74
74
  # @option opts [String] :cid The unique identifier of the authentication request.
75
75
  #
data/lib/services/chat.rb CHANGED
@@ -184,13 +184,7 @@ module SelfSDK
184
184
  body = @jwt.encode(body)
185
185
 
186
186
  env = @messaging.client.client.env
187
- if env.empty?
188
- return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app"
189
- elsif env == 'development'
190
- return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.dev"
191
- end
192
-
193
- "https://#{env}.links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.#{env}"
187
+ @jwt.build_dynamic_link(body, env, callback)
194
188
  end
195
189
 
196
190
  # Subscribes to a connection response
@@ -84,7 +84,7 @@ module SelfSDK
84
84
  # Generates a deep link to authenticate with self app.
85
85
  #
86
86
  # @param facts [Array] a list of facts to be requested.
87
- # @param callback [String] the url you'll be redirected if the app is not installed.
87
+ # @param callback [String] the callback identifier you'll be redirected to if the app is not installed.
88
88
  # @option opts [String] :selfid the user selfid you want to authenticate.
89
89
  # @option opts [String] :cid The unique identifier of the authentication request.
90
90
  #
@@ -124,7 +124,7 @@ module SelfSDK
124
124
  # Generates a deep link to authenticate with self app.
125
125
  #
126
126
  # @param facts [Array] a list of facts to be requested.
127
- # @param callback [String] the url you'll be redirected if the app is not installed.
127
+ # @param callback [String] the callback identifier you'll be redirected to if the app is not installed.
128
128
  # @option opts [String] :selfid the user selfid you want to authenticate.
129
129
  # @option opts [String] :cid The unique identifier of the authentication request.
130
130
  #
@@ -132,14 +132,9 @@ module SelfSDK
132
132
  def generate_deep_link(facts, callback, opts = {})
133
133
  opts[:request] = false
134
134
  selfid = opts.fetch(:selfid, "-")
135
- body = @client.jwt.encode(request(selfid, facts, opts))
136
135
 
137
- if @client.env.empty?
138
- return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app"
139
- elsif @client.env == 'development'
140
- return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.dev"
141
- end
142
- "https://#{@client.env}.links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.#{@client.env}"
136
+ body = @client.jwt.encode(request(selfid, facts, opts))
137
+ @client.jwt.build_dynamic_link(body, @client.env, callback)
143
138
  end
144
139
 
145
140
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.205
4
+ version: 0.0.206
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldgate Ventures