five_mobile_push 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,8 +20,14 @@ module FiveMobilePush
20
20
 
21
21
  attr_accessor *VALID_OPTION_KEYS
22
22
 
23
+ attr_writer :adapter
24
+
23
25
  def configure
24
26
  yield self
25
27
  end
26
28
 
29
+ def adapter
30
+ @adapter || Faraday.default_adapter
31
+ end
32
+
27
33
  end
@@ -5,18 +5,18 @@ module FiveMobilePush
5
5
 
6
6
  DEFAULT_ENDPOINT = 'https://push.fivemobile.com/rest/'
7
7
 
8
- attr_accessor :application_uid, :api_token
8
+ attr_accessor :application_uid, :api_token, :adapter
9
9
 
10
10
  def initialize(options={})
11
11
  self.application_uid = options[:application_uid] || FiveMobilePush.application_uid
12
- self.api_token = options[:api_token] || FiveMobilePush.api_token
12
+ self.api_token = options[:api_token] || FiveMobilePush.api_token
13
+ self.adapter = options[:adapter] || FiveMobilePush.adapter
13
14
  end
14
15
 
15
16
 
16
17
  def connection
17
18
  @connection ||= Faraday.new(:url => DEFAULT_ENDPOINT, :user_agent => 'FiveMobilePush Ruby gem') do |builder|
18
- builder.adapter Faraday.default_adapter
19
-
19
+ builder.adapter self.adapter
20
20
  builder.use Faraday::Response::Errors
21
21
  end
22
22
  end
@@ -32,17 +32,17 @@ module FiveMobilePush
32
32
  def device(device_uid)
33
33
  FiveMobilePush::Device.new(self, device_uid)
34
34
  end
35
-
35
+
36
36
  def notifier
37
37
  FiveMobilePush::Notifier.new(self)
38
38
  end
39
-
39
+
40
40
  def tag(device_uid)
41
41
  FiveMobilePush::Tag.new(self, device_uid)
42
42
  end
43
43
 
44
- private
45
-
44
+ private
45
+
46
46
  def perform_request(method, path, options={})
47
47
  options.merge!({:api_token => self.api_token, :application_id => self.application_uid })
48
48
  connection.send(method) do |request|
@@ -53,8 +53,8 @@ module FiveMobilePush
53
53
  request.path = path
54
54
  request.body = options
55
55
  end
56
- end
56
+ end
57
57
  end
58
-
58
+
59
59
  end
60
60
  end
@@ -1,3 +1,3 @@
1
1
  module FiveMobilePush
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: five_mobile_push
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kevin Faustino
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-03-30 00:00:00 -04:00
14
+ date: 2011-04-01 00:00:00 -04:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency