@@ -30,47 +30,49 @@ class Consumer
30
30
end
31
31
CA_FILE = nil unless defined? ( CA_FILE )
32
32
33
- @@default_options = {
34
- # Signature method used by server. Defaults to HMAC-SHA1
35
- signature_method : "HMAC-SHA1" ,
36
-
37
- # default paths on site. These are the same as the defaults set up by the generators
38
- request_token_path : "/oauth/request_token" ,
39
- authenticate_path : "/oauth/authenticate" ,
40
- authorize_path : "/oauth/authorize" ,
41
- access_token_path : "/oauth/access_token" ,
42
-
43
- proxy : nil ,
44
- # How do we send the oauth values to the server see
45
- # https://oauth.net/core/1.0/#consumer_req_param for more info
46
- #
47
- # Possible values:
48
- #
49
- # :header - via the Authorize header (Default) ( option 1. in spec)
50
- # :body - url form encoded in body of POST request ( option 2. in spec)
51
- # :query_string - via the query part of the url ( option 3. in spec)
52
- scheme : :header ,
53
-
54
- # Default http method used for OAuth Token Requests (defaults to :post)
55
- http_method : :post ,
56
-
57
- # Add a custom ca_file for consumer
58
- # :ca_file => '/etc/certs.pem'
59
-
60
- # Possible values:
61
- #
62
- # nil, false - no debug output
63
- # true - uses $stdout
64
- # some_value - uses some_value
65
- debug_output : nil ,
66
-
67
- # Defaults to producing a body_hash as part of the signature but
68
- # can be disabled since it's not officially part of the OAuth 1.0
69
- # spec. Possible values are true and false
70
- body_hash_enabled : true ,
71
-
72
- oauth_version : "1.0"
73
- }
33
+ @@default_options = SnakyHash ::SymbolKeyed . new (
34
+ {
35
+ # Signature method used by server. Defaults to HMAC-SHA1
36
+ signature_method : "HMAC-SHA1" ,
37
+
38
+ # default paths on site. These are the same as the defaults set up by the generators
39
+ request_token_path : "/oauth/request_token" ,
40
+ authenticate_path : "/oauth/authenticate" ,
41
+ authorize_path : "/oauth/authorize" ,
42
+ access_token_path : "/oauth/access_token" ,
43
+
44
+ proxy : nil ,
45
+ # How do we send the oauth values to the server see
46
+ # https://oauth.net/core/1.0/#consumer_req_param for more info
47
+ #
48
+ # Possible values:
49
+ #
50
+ # :header - via the Authorize header (Default) ( option 1. in spec)
51
+ # :body - url form encoded in body of POST request ( option 2. in spec)
52
+ # :query_string - via the query part of the url ( option 3. in spec)
53
+ scheme : :header ,
54
+
55
+ # Default http method used for OAuth Token Requests (defaults to :post)
56
+ http_method : :post ,
57
+
58
+ # Add a custom ca_file for consumer
59
+ # :ca_file => '/etc/certs.pem'
60
+
61
+ # Possible values:
62
+ #
63
+ # nil, false - no debug output
64
+ # true - uses $stdout
65
+ # some_value - uses some_value
66
+ debug_output : nil ,
67
+
68
+ # Defaults to producing a body_hash as part of the signature but
69
+ # can be disabled since it's not officially part of the OAuth 1.0
70
+ # spec. Possible values are true and false
71
+ body_hash_enabled : true ,
72
+
73
+ oauth_version : "1.0"
74
+ }
75
+ )
74
76
75
77
attr_accessor :options , :key , :secret
76
78
attr_writer :site , :http
@@ -103,7 +105,8 @@ def initialize(consumer_key, consumer_secret, options = {})
103
105
@secret = consumer_secret
104
106
105
107
# ensure that keys are symbols
106
- @options = @@default_options . merge ( options . transform_keys ( &:to_sym ) )
108
+ snaky_options = SnakyHash ::SymbolKeyed . new ( options )
109
+ @options = @@default_options . merge ( snaky_options )
107
110
end
108
111
109
112
# The default http method
0 commit comments