intercom 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/README.md +27 -8
- data/README.rdoc +1 -0
- data/Rakefile +18 -3
- data/intercom.gemspec +3 -5
- data/lib/data/cacert.pem +3965 -0
- data/lib/intercom.rb +91 -26
- data/lib/intercom/impression.rb +47 -0
- data/lib/intercom/message_thread.rb +128 -0
- data/lib/intercom/shallow_hash.rb +8 -0
- data/lib/intercom/social_profile.rb +43 -0
- data/lib/intercom/unix_timestamp_unwrapper.rb +11 -0
- data/lib/intercom/user.rb +133 -0
- data/lib/intercom/user_resource.rb +75 -0
- data/lib/intercom/version.rb +2 -2
- data/spec/integration/intercom_api_integration_spec.rb +28 -0
- data/spec/unit/intercom/impression_spec.rb +18 -0
- data/spec/unit/intercom/message_thread_spec.rb +74 -0
- data/spec/unit/intercom/user_resource_spec.rb +13 -0
- data/spec/unit/intercom/user_spec.rb +133 -0
- data/spec/unit/intercom_spec.rb +57 -0
- data/spec/unit/spec_helper.rb +80 -0
- metadata +41 -44
- data/Guardfile +0 -5
- data/spec/intercom_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -35
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intercom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-03-05 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|
18
|
-
requirement: &
|
18
|
+
requirement: &70093820212260 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70093820212260
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
|
-
requirement: &
|
29
|
+
requirement: &70093820211560 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,21 +34,10 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70093820211560
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
40
|
-
requirement: &
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
|
-
type: :development
|
47
|
-
prerelease: false
|
48
|
-
version_requirements: *70210115837980
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: guard
|
51
|
-
requirement: &70210115837060 !ruby/object:Gem::Requirement
|
39
|
+
name: rdoc
|
40
|
+
requirement: &70093820202300 !ruby/object:Gem::Requirement
|
52
41
|
none: false
|
53
42
|
requirements:
|
54
43
|
- - ! '>='
|
@@ -56,21 +45,10 @@ dependencies:
|
|
56
45
|
version: '0'
|
57
46
|
type: :development
|
58
47
|
prerelease: false
|
59
|
-
version_requirements: *
|
48
|
+
version_requirements: *70093820202300
|
60
49
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
62
|
-
requirement: &
|
63
|
-
none: false
|
64
|
-
requirements:
|
65
|
-
- - ! '>='
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '0'
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: *70210115835520
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: pry
|
73
|
-
requirement: &70210115833560 !ruby/object:Gem::Requirement
|
50
|
+
name: rake
|
51
|
+
requirement: &70093820198940 !ruby/object:Gem::Requirement
|
74
52
|
none: false
|
75
53
|
requirements:
|
76
54
|
- - ! '>='
|
@@ -78,10 +56,10 @@ dependencies:
|
|
78
56
|
version: '0'
|
79
57
|
type: :development
|
80
58
|
prerelease: false
|
81
|
-
version_requirements: *
|
59
|
+
version_requirements: *70093820198940
|
82
60
|
- !ruby/object:Gem::Dependency
|
83
61
|
name: mocha
|
84
|
-
requirement: &
|
62
|
+
requirement: &70093820196440 !ruby/object:Gem::Requirement
|
85
63
|
none: false
|
86
64
|
requirements:
|
87
65
|
- - ! '>='
|
@@ -89,9 +67,9 @@ dependencies:
|
|
89
67
|
version: '0'
|
90
68
|
type: :development
|
91
69
|
prerelease: false
|
92
|
-
version_requirements: *
|
70
|
+
version_requirements: *70093820196440
|
93
71
|
description: Intercom is a customer relationship management and messaging tool for
|
94
|
-
web app owners. See
|
72
|
+
web app owners. See https://www.intercom.io for more details.
|
95
73
|
email:
|
96
74
|
- ben@intercom.io
|
97
75
|
- ciaran@intercom.io
|
@@ -102,15 +80,28 @@ extra_rdoc_files: []
|
|
102
80
|
files:
|
103
81
|
- .gitignore
|
104
82
|
- Gemfile
|
105
|
-
- Guardfile
|
106
83
|
- README.md
|
84
|
+
- README.rdoc
|
107
85
|
- Rakefile
|
108
86
|
- intercom.gemspec
|
87
|
+
- lib/data/cacert.pem
|
109
88
|
- lib/intercom.rb
|
89
|
+
- lib/intercom/impression.rb
|
90
|
+
- lib/intercom/message_thread.rb
|
91
|
+
- lib/intercom/shallow_hash.rb
|
92
|
+
- lib/intercom/social_profile.rb
|
93
|
+
- lib/intercom/unix_timestamp_unwrapper.rb
|
94
|
+
- lib/intercom/user.rb
|
95
|
+
- lib/intercom/user_resource.rb
|
110
96
|
- lib/intercom/version.rb
|
111
|
-
- spec/
|
112
|
-
- spec/
|
113
|
-
|
97
|
+
- spec/integration/intercom_api_integration_spec.rb
|
98
|
+
- spec/unit/intercom/impression_spec.rb
|
99
|
+
- spec/unit/intercom/message_thread_spec.rb
|
100
|
+
- spec/unit/intercom/user_resource_spec.rb
|
101
|
+
- spec/unit/intercom/user_spec.rb
|
102
|
+
- spec/unit/intercom_spec.rb
|
103
|
+
- spec/unit/spec_helper.rb
|
104
|
+
homepage: http://www.intercom.io
|
114
105
|
licenses: []
|
115
106
|
post_install_message:
|
116
107
|
rdoc_options: []
|
@@ -130,10 +121,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
121
|
version: '0'
|
131
122
|
requirements: []
|
132
123
|
rubyforge_project: intercom
|
133
|
-
rubygems_version: 1.8.
|
124
|
+
rubygems_version: 1.8.10
|
134
125
|
signing_key:
|
135
126
|
specification_version: 3
|
136
127
|
summary: Ruby bindings for the Intercom API
|
137
128
|
test_files:
|
138
|
-
- spec/
|
139
|
-
- spec/
|
129
|
+
- spec/integration/intercom_api_integration_spec.rb
|
130
|
+
- spec/unit/intercom/impression_spec.rb
|
131
|
+
- spec/unit/intercom/message_thread_spec.rb
|
132
|
+
- spec/unit/intercom/user_resource_spec.rb
|
133
|
+
- spec/unit/intercom/user_spec.rb
|
134
|
+
- spec/unit/intercom_spec.rb
|
135
|
+
- spec/unit/spec_helper.rb
|
136
|
+
has_rdoc:
|
data/Guardfile
DELETED
data/spec/intercom_spec.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Intercom do
|
4
|
-
before do
|
5
|
-
Intercom.app_id = "abc123"
|
6
|
-
Intercom.secret_key = "super-secret-key"
|
7
|
-
@mock_rest_client = Intercom.mock_rest_client = mock()
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has a version number" do
|
11
|
-
Intercom::VERSION.must_equal "0.0.1"
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "/v1/users" do
|
15
|
-
describe "get" do
|
16
|
-
it "fetches a user" do
|
17
|
-
@mock_rest_client.expects(:get).with("users", {"email" => "bo@example.com"}).returns(test_user)
|
18
|
-
user = Intercom::User.find("email" => "bo@example.com")
|
19
|
-
user.email.must_equal "bo@example.com"
|
20
|
-
user.name.must_equal "Joe Schmoe"
|
21
|
-
user.session_count.must_equal 123
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "post" do
|
26
|
-
it "saves a user" do
|
27
|
-
user = Intercom::User.new("email" => "jo@example.com", "user_id" => "i-1224242")
|
28
|
-
@mock_rest_client.expects(:post).with("users", {}, {:content_type => :json}, {"email" => "bo@example.com"}.to_json)
|
29
|
-
user.save
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "correct use of ssl" do
|
35
|
-
end
|
36
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'intercom'
|
2
|
-
require 'minitest/autorun'
|
3
|
-
require 'mocha'
|
4
|
-
require 'pry'
|
5
|
-
IRB = Pry
|
6
|
-
|
7
|
-
module Intercom
|
8
|
-
def self.mock_rest_client=(client)
|
9
|
-
@mock_rest_client = client
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.execute_request(method, path, params = {}, headers= {}, payload = nil)
|
13
|
-
case method
|
14
|
-
when :get then @mock_rest_client.get(path, params)
|
15
|
-
when :post then @mock_rest_client.post(path, params, headers, payload)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_user
|
21
|
-
{
|
22
|
-
:user_id => 'mysql-id-from-customers-app for eg', # can request by this
|
23
|
-
:email => "bo@example.com", # can request by this
|
24
|
-
:session_count => 123, # can't be sent - but can get...
|
25
|
-
:created_at => 1323422442,
|
26
|
-
:last_request_at => 1323422442,
|
27
|
-
:name => "Joe Schmoe",
|
28
|
-
:social_accounts => {
|
29
|
-
"twitter" => [{"url" => "http://twitter.com/abc", "username" => "abc"}, {"username" => "abc2", "url" => "http://twitter.com/abc2"}],
|
30
|
-
"facebook" => [{"url" => "http://facebook.com/abc", "username" => "abc", "id" => "1234242"}],
|
31
|
-
"quora" => [{"url" => "http://facebook.com/abc", "username" => "abc", "id" => "1234242"}]
|
32
|
-
},
|
33
|
-
:custom_data => {"a" => 1, "b" => {"nested-hash" => ["ab", 12, {"deep" => "man"}]}}
|
34
|
-
}
|
35
|
-
end
|