intercom 0.1.10 → 0.1.11
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.
- data/lib/intercom.rb +9 -0
- data/lib/intercom/hashable_object.rb +2 -2
- data/lib/intercom/version.rb +1 -1
- data/spec/unit/intercom_spec.rb +5 -0
- metadata +3 -2
data/lib/intercom.rb
CHANGED
@@ -37,6 +37,10 @@ module Intercom
|
|
37
37
|
@app_id = app_id
|
38
38
|
end
|
39
39
|
|
40
|
+
def self.app_id
|
41
|
+
@app_id
|
42
|
+
end
|
43
|
+
|
40
44
|
##
|
41
45
|
# Set the api key to gain access to your application data.
|
42
46
|
# When logged into your intercom console, you can view/create api keys in the settings menu
|
@@ -46,7 +50,12 @@ module Intercom
|
|
46
50
|
@api_key = api_key
|
47
51
|
end
|
48
52
|
|
53
|
+
def self.api_key
|
54
|
+
@api_key
|
55
|
+
end
|
56
|
+
|
49
57
|
private
|
58
|
+
|
50
59
|
def self.target_base_url
|
51
60
|
raise ArgumentError, "You must set both Intercom.app_id and Intercom.api_key to use this client. See https://github.com/intercom/intercom-ruby for usage examples." if [@app_id, @api_key].any?(&:nil?)
|
52
61
|
basic_auth_part = "#{@app_id}:#{@api_key}@"
|
@@ -12,11 +12,11 @@ module Intercom
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def displayable_attributes
|
15
|
-
to_hash.select {|attribute, value| self.respond_to?(attribute) }
|
15
|
+
Hash[ to_hash.select {|attribute, value| self.respond_to?(attribute) } ]
|
16
16
|
end
|
17
17
|
|
18
18
|
def to_wire
|
19
|
-
to_hash.select {|attribute, value| self.respond_to?("#{attribute.to_s}=") }
|
19
|
+
Hash[ to_hash.select {|attribute, value| self.respond_to?("#{attribute.to_s}=") } ]
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/intercom/version.rb
CHANGED
data/spec/unit/intercom_spec.rb
CHANGED
@@ -17,6 +17,11 @@ describe Intercom do
|
|
17
17
|
proc { Intercom.target_base_url }.must_raise ArgumentError, "You must set both Intercom.app_id and Intercom.api_key to use this client. See https://github.com/intercom/intercom-ruby for usage examples."
|
18
18
|
end
|
19
19
|
|
20
|
+
it "returns the app_id and api_key previously set" do
|
21
|
+
Intercom.app_id.must_equal "abc123"
|
22
|
+
Intercom.api_key.must_equal "super-secret-key"
|
23
|
+
end
|
24
|
+
|
20
25
|
it "defaults to https to api.intercom.io" do
|
21
26
|
Intercom.target_base_url.must_equal "https://abc123:super-secret-key@api.intercom.io"
|
22
27
|
end
|
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.1.
|
4
|
+
version: 0.1.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-
|
16
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: minitest
|
@@ -147,3 +147,4 @@ test_files:
|
|
147
147
|
- spec/unit/intercom/user_resource_spec.rb
|
148
148
|
- spec/unit/intercom/user_spec.rb
|
149
149
|
- spec/unit/intercom_spec.rb
|
150
|
+
has_rdoc:
|