phoenix_rails 0.0.1 → 0.0.2

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: 7709aaa6258a7487078052fdbe24809e9890152f
4
- data.tar.gz: 9b210022272c81b6f95dc80d6bd1e26a754dcc0d
3
+ metadata.gz: 7d9c70f2565a6a3365f859514661e95200cccf4c
4
+ data.tar.gz: e92524690a09ad5534b830bf078063d85270a91e
5
5
  SHA512:
6
- metadata.gz: a272113710ee384f2b5b478ce85b2a5994ac36b9f39bf808ba052630c7aa4ea3c5e10a943a430173a4a9c6c03b191144d3d79fdc4cf07093d32f24772d88dd2e
7
- data.tar.gz: b05cc1b45a2afee0b327925bba1b9191383c46f053ed5983089f951ad675d3321436464b7dc3e9f02cd958a20b6462e4d24c1567a9f7e573afe535d7166ef49f
6
+ metadata.gz: e0fdf81dd64ce612403a7158daf5750520a9b754180f245f06d8df45ddfebfb799421a1754ad4944921b5d0894b8adfe7d48a4c54b08fc3c9c0b9fe2a3080d39
7
+ data.tar.gz: 87fa8547e75de9d80376ffeeb716c1b9b3bc925de4e7f315d4ca1ed4b540bdeda557437f16968b132acb42306ea22649ab98bd2f47723453bf3803ea566fdabe
@@ -1,19 +1,18 @@
1
- ire 'signature'
1
+ require 'signature'
2
2
 
3
3
  module PhoenixRails
4
4
  class Client
5
- attr_accessor :scheme, :host, :port, :app_id, :key, :secret
5
+ attr_accessor :scheme, :host, :port, :key, :secret
6
6
  attr_writer :connect_timeout, :send_timeout, :receive_timeout, :keep_alive_timeout
7
7
 
8
8
 
9
9
  def initialize(options = {})
10
10
  options = {
11
11
  :scheme => 'http',
12
- :host => 'api.phoenixapp.com',
13
12
  :port => 80,
14
13
  }.merge(options)
15
- @scheme, @host, @port, @app_id, @key, @secret = options.values_at(
16
- :scheme, :host, :port, :app_id, :key, :secret
14
+ @scheme, @host, @port, @key, @secret = options.values_at(
15
+ :scheme, :host, :port, :key, :secret
17
16
  )
18
17
 
19
18
  # Default timeouts
@@ -26,7 +25,6 @@ module PhoenixRails
26
25
  def url=(url)
27
26
  uri = URI.parse(url)
28
27
  @scheme = uri.scheme
29
- @app_id = uri.path.split('/').last
30
28
  @key = uri.user
31
29
  @secret = uri.password
32
30
  @host = uri.host
@@ -62,7 +60,7 @@ module PhoenixRails
62
60
  end
63
61
 
64
62
  def channel(channel_name)
65
- raise ConfigurationError, 'Missing client configuration: please check that key, secret and app_id are configured.' unless configured?
63
+ raise ConfigurationError, 'Missing client configuration: please check that key, secret are configured.' unless configured?
66
64
  Channel.new(url, channel_name, self)
67
65
  end
68
66
 
@@ -76,6 +74,10 @@ module PhoenixRails
76
74
  post('/events', trigger_params(channels, event_name, data, params))
77
75
  end
78
76
 
77
+ def authentication_token
78
+ Signature::Token.new(@key, @secret)
79
+ end
80
+
79
81
  # @private Construct a net/http http client
80
82
  def http_client
81
83
  @client ||= begin
@@ -116,7 +118,7 @@ module PhoenixRails
116
118
  end
117
119
 
118
120
  def configured?
119
- host && scheme && key && secret && app_id
121
+ host && scheme && key && secret
120
122
  end
121
123
 
122
124
  end
@@ -35,7 +35,7 @@ module PhoenixRails
35
35
 
36
36
  body = response.body ? response.body.chomp : nil
37
37
 
38
- return handle_response(response.code.to_i, body)
38
+ handle_response(response.code.to_i, body)
39
39
  end
40
40
 
41
41
  private
data/lib/phoenix_rails.rb CHANGED
@@ -7,8 +7,8 @@ class PhoenixRails
7
7
  class << self
8
8
  extend Forwardable
9
9
 
10
- def_delegators :default_client, :scheme, :host, :port, :app_id, :key, :secret
11
- def_delegators :default_client, :scheme=, :host=, :port=, :app_id=, :key=, :secret=
10
+ def_delegators :default_client, :scheme, :host, :port, :key, :secret
11
+ def_delegators :default_client, :scheme=, :host=, :port=, :key=, :secret=
12
12
 
13
13
  def_delegators :default_client, :authentication_token, :url
14
14
  def_delegators :default_client, :encrypted=, :url=
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phoenix_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nguyen Le
@@ -49,7 +49,7 @@ files:
49
49
  - lib/phoenix_rails/client.rb
50
50
  - lib/phoenix_rails/request.rb
51
51
  - lib/phoenix_rails/resource.rb
52
- homepage: http://rubygems.org/gems/phoenix_rails
52
+ homepage: https://github.com/nathanle89/phoenix_rails
53
53
  licenses:
54
54
  - MIT
55
55
  metadata: {}