togglehq 1.0.0 → 1.1.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: 9e9a3e30065d07e0093a28ec7d427fc0f75f1c57
4
- data.tar.gz: 721d571e9201b23658e35462ea70158ef6440cf3
3
+ metadata.gz: ec05a3d9b1ca854f13bd1eb2e240a51b59789e65
4
+ data.tar.gz: 84ffb1d582688afdcf054d9cbf68e76d4d284f91
5
5
  SHA512:
6
- metadata.gz: 4abb7be7cf8900c032abb5085c739fcddcbc3dba5017fafdc45483183d0b6ea5675427d475a894246e98c1704a3c09167843aa5beea37bcecb7cfce1b3110e87
7
- data.tar.gz: 078c8177e6942d549eef97728f1b1b902c4ccdb561dcc9f381a09d8f662bc88fc9272f93c640eeee463aa27da0532780a9377097fb89ff0cc4781b621dacf895
6
+ metadata.gz: 130f1635f38c1d3aeb84c343f5916b19d9f118aa002e676442d384a0776a16a2b09a2285c77ea33bea2606fafc3214b986cf717176167bde0adb502648b0ab1f
7
+ data.tar.gz: 31fbd63d206b06f1a36591fa2f05dbed5ceda9b88944a5b9f6b31b14c6787ca0c359e17477c70bbfbb819196c99eef58d0161d26776936ec3e2cf53bf09d89b3
data/README.md CHANGED
@@ -29,6 +29,10 @@ Togglehq.configure do |config|
29
29
 
30
30
  # To log the HTTP requests/responses to and from the ToggleHQ API, set log_requests to true (defaults to false)
31
31
  config.log_requests = true
32
+
33
+ # To modify the adapter used for network connections (defaults to :net_http_persistent)
34
+ # Available: [:net_http, :net_http_persistent, :excon, :typhoeus, :patron, :em_http, :httpclient]
35
+ config.adapter = :net_http
32
36
  end
33
37
  ```
34
38
 
@@ -66,7 +70,7 @@ preferences = Togglehq::Notify::Preferences.all
66
70
  A `Togglehq::Notify::Preferences` object has a `categories` attribute which contains an array of all preference categories:
67
71
  ```ruby
68
72
  preferences.categories
69
- => [{"name"=>"Friends", "key"=>"friends", "preferences"=>[{"name"=>"Friend Request", "key"=>"friend_request", "default"=>true}]}]
73
+ => [{"name"=>"Friends", "key"=>"friends", "preferences"=>[{"name"=>"Friend Request", "key"=>"friend_request", "default"=>true}]}]
70
74
  ```
71
75
 
72
76
  Each preference category contains a name, a key, and an array of preferences, which also have a name, key, and default value.
@@ -84,7 +88,7 @@ user_preferences = Togglehq::Notify::UserPreferences.new(user)
84
88
  Get the user's preferences by calling the `categories` method:
85
89
  ```ruby
86
90
  user_preferences.categories
87
- => [{"name"=>"Friends", "key"=>"friends", "preferences"=>[{"name"=>"Friend Request", "key"=>"friend_request", "default"=>true, "enabled"=>true}]}]
91
+ => [{"name"=>"Friends", "key"=>"friends", "preferences"=>[{"name"=>"Friend Request", "key"=>"friend_request", "default"=>true, "enabled"=>true}]}]
88
92
  ```
89
93
 
90
94
  Like `Togglehq::Notify::Preferences`, a `Togglehq::Notify::UserPreferences` object has a `categories` attribute which contains an array of all preference categories.
@@ -143,26 +147,6 @@ notification.send_global
143
147
  This will return true upon success, and raise a RuntimeError on failure.
144
148
 
145
149
 
146
- ## Gotchas
147
-
148
- If you encounter SSL errors while using the togglehq-gem similar to the following:
149
-
150
- ```
151
- Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
152
- ```
153
-
154
- ToggleHQ's SSL certificate is issued by Comodo. Comodo recently added a new certificate root, which may not be in your Ruby/OpenSSL trusted root certificates file. To find the location of your root file:
155
-
156
- ```ruby
157
- require 'openssl'
158
- puts OpenSSL::X509::DEFAULT_CERT_FILE
159
- ```
160
-
161
- This will output something like `/usr/local/etc/openssl/cert.pem`. Open this file, and add the "Comodo RSA Certification Authority (SHA-2)"" root cert PEM found [here](https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/969/108/root-comodo-rsa-certification-authority-sha-2) to this file.
162
-
163
- For more gory details, [see this excellent blog post](http://mislav.net/2013/07/ruby-openssl/) and this [StackOverflow question](http://stackoverflow.com/questions/36966650/ruby-nethttp-responds-with-opensslsslsslerror-certificate-verify-failed).
164
-
165
-
166
150
  ## Contributing
167
151
 
168
152
  Bug reports and pull requests are welcome on GitHub at https://github.com/togglehq/togglehq-gem.
data/lib/togglehq.rb CHANGED
@@ -33,7 +33,7 @@ module Togglehq
33
33
 
34
34
  def self.connection
35
35
  conn = Faraday.new(:url => config.uri) do |faraday|
36
- faraday.adapter :net_http_persistent
36
+ faraday.adapter config.adapter
37
37
  faraday.response :logger, self.logger, bodies: true if config.log_requests
38
38
  end
39
39
  conn
@@ -4,10 +4,12 @@ module Togglehq
4
4
  attr_accessor :client_secret
5
5
  attr_accessor :uri
6
6
  attr_accessor :log_requests
7
+ attr_accessor :adapter
7
8
 
8
9
  def initialize
9
10
  @uri = "https://api.togglehq.com"
10
11
  @log_requests = false
12
+ @adapter = :net_http_persistent
11
13
  end
12
14
  end
13
15
  end
@@ -1,3 +1,3 @@
1
1
  module Togglehq
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togglehq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toggle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-23 00:00:00.000000000 Z
11
+ date: 2016-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler