ue-ruby-sdk 1.1.9 → 1.1.12

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: 07632756fe81c502546d82e9973a9ebabc571c93
4
- data.tar.gz: 1ffa75978ad2fd68da11c4222213f1dc8003b13c
3
+ metadata.gz: 23436bfab07c4e5b4838be97cc45e559d7e50f66
4
+ data.tar.gz: 9463bc3ae933edd1f5869f3664c1c7532a0209b7
5
5
  SHA512:
6
- metadata.gz: 1ea2e50908d40c0acc8ca224f914bbe0a753c0e78dc373b295c07b850939b4d155302570ac99a8959a88df1927e27d1b7aafe68c72d6146c4600b4a8a127ab19
7
- data.tar.gz: 4154e93e3c718815d036933e3a8177f4145aac984abf21604742c6e9ffcd03f60fdd4c1b77b428d9ae9faf02854402bdcc5bcacf6f966879f76f3d17fc3747df
6
+ metadata.gz: aa270173e444d6855b3b8c3f8bfb43400ea876d5b84bb9e163fc2d739de50fda3f50fff321f223068aa7f54f177f1c10738ac4c85c8abe5a167d7db21fc00775
7
+ data.tar.gz: 95979c467216d2605691812d0decab79964651e40fcb6645af6f933679183bc361d58475516e410dab124bbd4215c1f7d7b6ba5b66bb01909f60622704df1b7e
data/README.md CHANGED
@@ -10,13 +10,21 @@ $ gem install ue-ruby-sdk
10
10
  ## Usage
11
11
 
12
12
  ```ruby
13
- var app = UEApp.new("APP_KEY","APP_SECRET");
13
+ app = UEApp.new("APP_KEY","APP_SECRET");
14
14
  ```
15
15
 
16
16
  #### Creating User
17
17
  ```ruby
18
+ #Creating a new user
18
19
  user = app.create_user
19
- #user is an instance of UEUser
20
+
21
+ #Using existing user using key and secret
22
+ user = UEUser.new "USER_KEY","USER_SECRET"
23
+
24
+ #Using existing user using it's uri
25
+ user = UEUser.new "user://USER_KEY:USER_SECRET@"
26
+
27
+
20
28
  ```
21
29
 
22
30
  #### Listing Users
@@ -33,7 +41,7 @@ app.delete_user(user) #true
33
41
 
34
42
  #### Adding a connection to a user
35
43
  ```ruby
36
- connection = user.add_connection "myconnectionname", "facebook", "facebook_access_token")
44
+ connection = user.add_connection "myconnectionname", "facebook", "facebook_access_token"
37
45
  #connection is an instance of UEConnection
38
46
  ```
39
47
 
@@ -59,14 +67,18 @@ user.test_connection(service_url) #eg: facebook://accesstoken@facebook.com
59
67
 
60
68
  ### Sending a message using a connection
61
69
  ```ruby
70
+ require 'ue-ruby-sdk'
71
+
72
+ app = UEApp.new("UE_APP_ID","UE_APP_SECRET")
73
+
62
74
  options = {
63
75
  receivers:[
64
76
  {
65
- name:"me"
77
+ name:"Page",
78
+ id:"283031198486599"
66
79
  },
67
80
  {
68
- name:"Page",
69
- id:"122"
81
+ name: "Me"
70
82
  }
71
83
  ],
72
84
  message:{
@@ -81,6 +93,21 @@ options = {
81
93
  }
82
94
  }
83
95
 
84
- #uris will hold the uris for the sent messages
85
- uris = app.list_connections[0].send_message options
96
+
97
+
98
+ #Create a new user
99
+ user = app.create_user
100
+
101
+
102
+ facebook_connection = user.add_connection "fb", "facebook","FACEBOOK_ACCESS_TOKEN"
103
+ # | |
104
+ # Connection Name ------------------------+ |
105
+ # Connector Scheme ---------------------------------+
106
+
107
+
108
+
109
+
110
+ facebook_connection.send_message options
111
+
112
+
86
113
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.9
1
+ 1.1.12
@@ -16,11 +16,11 @@ class UEApp
16
16
  #
17
17
  # @return {UEUser} user the created user
18
18
  #
19
- def create_user()
19
+ def create_user()
20
20
  response = UERequest.fetch "user/create", {
21
21
  user: @api_key,
22
22
  pass: @api_secret
23
- }
23
+ }
24
24
  response[:uri] ? UEUser.new(response[:uri]) : nil
25
25
  end
26
26
 
@@ -30,7 +30,7 @@ class UEApp
30
30
  # @param {UEUser} user the user to delete
31
31
  # @return {Boolean} success/fail
32
32
  #
33
- def delete_user( user )
33
+ def delete_user( user )
34
34
  response = UERequest.fetch "user/delete", {
35
35
  user: @api_key,
36
36
  pass: @api_secret,
@@ -46,13 +46,13 @@ class UEApp
46
46
  #
47
47
  # @return {String[]} array of user uri without password
48
48
  #
49
- def list_users()
49
+ def list_users()
50
50
  response = UERequest.fetch "user/list", {
51
51
  user: @api_key,
52
52
  pass: @api_secret
53
53
  }
54
54
 
55
- $logger.debug response[:users].inspect
55
+ # $logger.debug response[:users].inspect
56
56
  users = response[:users].map { |user| user.symbolize_keys[:uri] }
57
57
  end
58
58
 
@@ -16,7 +16,7 @@ class UEConnection
16
16
  @user
17
17
  end
18
18
 
19
- def refresh_connection()
19
+ def refresh_connection()
20
20
  end
21
21
 
22
22
  ##
@@ -56,7 +56,7 @@ class UEConnection
56
56
 
57
57
  #Formulate Receivers
58
58
  params[:receivers] = params[:receivers].map { |receiver|
59
- if receiver[:name ] && receiver[:name].downcase == "me"
59
+ if receiver[:name ] && receiver[:name].downcase == "me"
60
60
  {
61
61
  name:"Me",
62
62
  address:"test.test",
@@ -85,7 +85,7 @@ class UEConnection
85
85
  end
86
86
 
87
87
  #Image Part
88
- if params[:message].key?(:image)
88
+ if params[:message].key?(:image)
89
89
  queryObject[:parts].push({
90
90
  id: UEConnection.generate_unique_id,
91
91
  contentType: default_content_type,
@@ -133,7 +133,7 @@ class UEConnection
133
133
  end
134
134
 
135
135
 
136
- $logger.info(queryObject);
136
+ # $logger.info(queryObject);
137
137
  return queryObject;
138
138
 
139
139
 
@@ -165,7 +165,7 @@ class UEConnection
165
165
  pass: @user.user_secret,
166
166
  form:{
167
167
  message: self.build_message_query(message_options)
168
- }
168
+ }
169
169
  }
170
170
 
171
171
  response[:URIs] rescue []
@@ -43,7 +43,7 @@ class UEUser
43
43
  #
44
44
  # @return {UEConnection} connection the created connection
45
45
  #/
46
- def add_connection(connection_name, service_scheme, service_access_token)
46
+ def add_connection(connection_name, service_scheme, service_access_token)
47
47
  uri = "#{service_scheme}://#{service_access_token}@#{service_scheme}.com"
48
48
  response = UERequest.fetch "connection/add",{
49
49
  user: @user_key,
@@ -54,7 +54,7 @@ class UEUser
54
54
  }
55
55
  }
56
56
 
57
- puts response
57
+ # puts response
58
58
  connection = UEConnection.new connection_name, uri, self
59
59
  (response[:status]==200)? connection : response
60
60
 
@@ -64,7 +64,7 @@ class UEUser
64
64
  ##
65
65
  # List connections for current user
66
66
  # @return {Connection>} List of Connection objects representing the user connections
67
- def list_connections()
67
+ def list_connections()
68
68
 
69
69
  response = UERequest.fetch "connection/list",{
70
70
  user: @user_key,
@@ -76,10 +76,10 @@ class UEUser
76
76
  end
77
77
 
78
78
  connections = []
79
- response[:connections].each do |cname,v|
79
+ response[:connections].each do |cname,v|
80
80
  connections.push(UEConnection.new cname, response[:connections][cname.to_sym][:uri], self)
81
81
  end
82
- connections
82
+ connections
83
83
 
84
84
  end
85
85
 
@@ -91,7 +91,7 @@ class UEUser
91
91
  # @param {String} connection_name the connection identifier
92
92
  # @return {Boolean} Success/Fail
93
93
  #
94
- def remove_connection(connection_name)
94
+ def remove_connection(connection_name)
95
95
  response = UERequest.fetch "connection/remove",{
96
96
  user: @user_key,
97
97
  pass: @user_secret,
@@ -112,7 +112,7 @@ class UEUser
112
112
  # @param {String} serviceUri service uri. eg: facebook://accesstoken@facebook.com
113
113
  # @return {Boolean} Success/Fail
114
114
  #
115
- def test_connection(service_uri)
115
+ def test_connection(service_uri)
116
116
  response = UERequest.fetch "connection/test",{
117
117
  user: @user_key,
118
118
  pass: @user_secret,
@@ -121,7 +121,7 @@ class UEUser
121
121
  }
122
122
  }
123
123
 
124
- response[:Status][:""][:status] == 200
124
+ response[:Status][:""][:status] == 200
125
125
 
126
126
 
127
127
 
@@ -8,16 +8,16 @@ class UERequest
8
8
  user = request_options[:user]
9
9
  pass = request_options[:pass]
10
10
 
11
- $logger.debug form.inspect
11
+ # $logger.debug form.inspect
12
12
  #Inject user:pass into base url
13
13
  url_prefix = Constants.base_url.gsub /https?:\/\//, "https://#{user}:#{pass}@"
14
14
  #Concat base url with resource
15
15
  url = url_prefix + resource
16
- $logger.debug "http => #{url}"
16
+ # $logger.debug "http => #{url}"
17
17
 
18
18
  response = RestClient.post url, form.to_json
19
19
 
20
- $logger.debug "resp => #{JSON.parse(response).deep_symbolize_keys}"
20
+ # $logger.debug "resp => #{JSON.parse(response).deep_symbolize_keys}"
21
21
  JSON.parse(response).deep_symbolize_keys rescue response
22
22
  end
23
23
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: ue-ruby-sdk 1.1.9 ruby lib
5
+ # stub: ue-ruby-sdk 1.1.12 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "ue-ruby-sdk"
9
- s.version = "1.1.9"
9
+ s.version = "1.1.12"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Hossam Saraya"]
14
- s.date = "2016-03-11"
14
+ s.date = "2016-04-29"
15
15
  s.description = "UnificationEngine Ruby SDK as a wrapper over UnificationEngine API"
16
16
  s.email = "hossam.saraya@gmail.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ue-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hossam Saraya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-11 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging