kahuna_client 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 852f844be1e7f03829000aac9fd1f81ca72a5ee7
4
- data.tar.gz: 17f5b26cda633d94e4c6e686131b21391b3df747
3
+ metadata.gz: 4052ca43fe8bdd726d9dfaa0cc68a52530489586
4
+ data.tar.gz: 2978711a94e632aad911c88b713f46de3b3e0330
5
5
  SHA512:
6
- metadata.gz: bb2568e9d342aee5e120dcbdb5ce937fce9ff458169ac25310da5dda0d843a749c71da79e7a3c1a2340c5910b32ccb857f48856b7ffcb7759b579089a63c0f37
7
- data.tar.gz: dbb94ece76075cc71a66f30406398a85a0391495189b6b4ab6715fa78e41053c1fc997708f25fc1c2fa18b4446730a738bb8dfb8974e860c4d71eb451d13f5e7
6
+ metadata.gz: 824ae0fd5b9039b6b8526e6d6347aaa19a1cdee565cbca5aff2e3c7a5d41311ba52c1e2a6d0b412f98d2fc7c1930a9190b9115de3049899ccfb49b6eaa06dc11
7
+ data.tar.gz: d2fea71a23f136ffea86998ec70ced202d0f16cb7924863c53fc7ffc4f984a8509c2ee920c588ee97d199752ce7b2de39a21ed64c7c1127513989ffe35b36796
@@ -5,5 +5,6 @@ module KahunaClient
5
5
 
6
6
  include KahunaClient::Client::Push
7
7
  include KahunaClient::Client::Logs
8
+ include KahunaClient::Client::UserAttribute
8
9
  end
9
- end
10
+ end
@@ -0,0 +1,23 @@
1
+ module KahunaClient
2
+ class Client
3
+ module UserAttribute
4
+
5
+ #
6
+ # Send attributes data update to specific target user.
7
+ # @params
8
+ # user_attributes_array: Array of one or more user's attributes.
9
+ #
10
+ def update(attr_array)
11
+ request_object = {
12
+ :user_attributes_array => attr_array
13
+ }
14
+ post(userattributes_path, request_object)
15
+ end
16
+
17
+ protected
18
+ def userattributes_path
19
+ "api/userattributes"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module KahunaClient
2
- VERSION = "0.0.4".freeze unless defined?(::KahunaClient::VERSION)
2
+ VERSION = "0.0.5".freeze unless defined?(::KahunaClient::VERSION)
3
3
  end
@@ -35,11 +35,11 @@ describe KahunaClient::Client do
35
35
 
36
36
  # should have the proper fields
37
37
  [:cursor, :more_records, :push].each do |key|
38
- expect(logs.has_key?(key)).to be_true
38
+ expect(logs.has_key?(key)).to be true
39
39
  end
40
40
 
41
41
  # push array should have the proper size
42
- expect(logs.push).to have(5).items
42
+ expect(logs.push.size).to be 5
43
43
  end
44
44
  end
45
45
 
@@ -0,0 +1,40 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ describe KahunaClient::Client do
4
+ before do
5
+ @client = KahunaClient::Client.new(app_id: 'ID', app_key: 'KEY', environment: 'p')
6
+ end
7
+
8
+ describe ".update" do
9
+ let(:user_attribute) do
10
+ {
11
+ :target => {
12
+ :username => "iamawesome1989",
13
+ :email => "awesome@mail.com",
14
+ :fbid => "42",
15
+ :user_id => "789"
16
+ },
17
+ :attributes => {
18
+ :first_name => "I Am",
19
+ :last_name => "Awesome",
20
+ :date_updated => "2015-05-12 15:11:51 +0700"
21
+ }
22
+ }
23
+ end
24
+
25
+ let(:request_object) do
26
+ { :user_attributes_array => [user_attribute] }
27
+ end
28
+
29
+ before do
30
+ stub_post('api/userattributes?env=p')
31
+ .with(:body => request_object)
32
+ .to_return(:body => fixture('success.json'))
33
+ end
34
+
35
+ it "should get the correct resource" do
36
+ @client.update([user_attribute])
37
+ expect(a_post("api/userattributes?env=p").with(:body => request_object)).to have_been_made.once
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kahuna_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar Gonzalez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-27 00:00:00.000000000 Z
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -156,6 +156,7 @@ files:
156
156
  - lib/kahuna_client/client.rb
157
157
  - lib/kahuna_client/client/logs.rb
158
158
  - lib/kahuna_client/client/push.rb
159
+ - lib/kahuna_client/client/user_attribute.rb
159
160
  - lib/kahuna_client/configuration.rb
160
161
  - lib/kahuna_client/connection.rb
161
162
  - lib/kahuna_client/error.rb
@@ -170,6 +171,7 @@ files:
170
171
  - spec/kahuna_client/api_spec.rb
171
172
  - spec/kahuna_client/client/logs_spec.rb
172
173
  - spec/kahuna_client/client/push_spec.rb
174
+ - spec/kahuna_client/client/user_attribute_spec.rb
173
175
  - spec/kahuna_client/client_spec.rb
174
176
  - spec/kahuna_client_spec.rb
175
177
  - spec/spec_helper.rb
@@ -207,6 +209,7 @@ test_files:
207
209
  - spec/kahuna_client/api_spec.rb
208
210
  - spec/kahuna_client/client/logs_spec.rb
209
211
  - spec/kahuna_client/client/push_spec.rb
212
+ - spec/kahuna_client/client/user_attribute_spec.rb
210
213
  - spec/kahuna_client/client_spec.rb
211
214
  - spec/kahuna_client_spec.rb
212
215
  - spec/spec_helper.rb