ribbon-intercom 0.1.1 → 0.2.0

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: f19a9d7871332a1a8abfb1a9b3a376c17b7389a0
4
- data.tar.gz: b946129b0caf8b2d3a2236ec58d1a177e692fc96
3
+ metadata.gz: 87b9234dd91d967a7e9ac67695b3f9f55da7a2f5
4
+ data.tar.gz: f13e76b16900a91515b669350a90df8e79117c2b
5
5
  SHA512:
6
- metadata.gz: 0cd606324dd603044b14c318fd0194b7ef571c91214931a519e9b4d3e7c8920d7d82f5220693709dc36dfa6f135967306c569d3dd317fa740f901d70688b318d
7
- data.tar.gz: 3de7e4b3da0da1aa1619c91a1c8ac9676dc9509f033e5af1192b5038286829cba55a828042006ba399da81d114b77be43d8afc9d974ff66c4a17a98288cc67ab
6
+ metadata.gz: 8648023e48133c9820fd031cfd119e14104b971c238189ed57d887bb4c8fb5780a94045ffb0e405bcfa719f4a3b062e8898c91e5e44cdcb641c9be674ca6ecf0
7
+ data.tar.gz: 4d08aff90f5829f196ec2516ef8fcd8305f8ccc5bddfaf857daf9ec6ef3762668239948f0b5a6260fee1ab3bdcc97145cc0a2a9be963c82b5fdc71d9ab2d03e1
@@ -17,6 +17,8 @@ module Ribbon::Intercom
17
17
  end
18
18
 
19
19
  def _load_sdk(handle, url=nil, token=nil, secret=nil)
20
+ raise Errors::NoRemotesCreatedError unless config.remote?
21
+
20
22
  (@_sdk_instances ||= Hash.new { |hash, key|
21
23
  if (remote = config.remote.select { |r| r.first == key }.last)
22
24
  # Get the last remote if there are duplicates
@@ -9,6 +9,7 @@ module Ribbon::Intercom
9
9
 
10
10
  # Intercom Errors
11
11
  class RemoteNotFoundError < Error; end
12
+ class NoRemotesCreatedError < Error; end
12
13
 
13
14
  # Service Errors
14
15
  class NoPermissionsError < Error; end
@@ -115,6 +115,10 @@ module Ribbon::Intercom
115
115
  _response(500, {}, e.message).finish
116
116
  end
117
117
 
118
+ def validate!(assertion, error_msg="")
119
+ assertion.tap { _respond!(400, {}, error_msg) unless assertion }
120
+ end
121
+
118
122
  private
119
123
 
120
124
  def _setup_request
@@ -1,5 +1,5 @@
1
1
  module Ribbon
2
2
  module Intercom
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -16,7 +16,14 @@ module Ribbon
16
16
  end
17
17
 
18
18
  def client
19
- @__client ||= Client.new
19
+ @_client ||= Client.new
20
+ end
21
+
22
+ def mock_safe
23
+ primary_client = client
24
+ @_client = @_client.dup
25
+ yield
26
+ @_client = primary_client
20
27
  end
21
28
  end # Intercom
22
29
  end # Ribbon
@@ -15,8 +15,9 @@ namespace :intercom do
15
15
  service = Intercom::Utils.classify(args[:service_name])
16
16
  channel_name = args[:channel_name]
17
17
 
18
- Intercom::const_get(service).open_channel(name: channel_name)
19
- puts "New channel: #{channel_name}"
18
+ channel = Intercom::const_get(service).open_channel(name: channel_name)
19
+ secret = channel.rotate_secret!
20
+ puts "New channel: #{channel_name} with token: #{channel.token} and secret: #{secret}"
20
21
  end
21
22
  end
22
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ribbon-intercom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Honer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-06 00:00:00.000000000 Z
12
+ date: 2015-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack