twitter-request-headers 0.0.11 → 0.0.12

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: c0095a9ef3721e90ceff67651b3144a478573e08
4
- data.tar.gz: 395b48f6271732cca021fb789297421875018252
3
+ metadata.gz: d3bf20f690c4b4a250baba42d7baf843394e4f75
4
+ data.tar.gz: 64af4aa26e9fb1e5291ff83155479913191031d0
5
5
  SHA512:
6
- metadata.gz: 2346565020978c2ca0a3fcc5c7ffdbe78684960ca25dcb9ff98e1b832f60779072e92889c3d2420976b6fecc5af608e18e8c7b9e862cff354ebd5222e15aa602
7
- data.tar.gz: cd0b704a3e0201b6b325f2375f6ca85afdf79efa3efde4601ce4c0767a8e2cdb348401df92e1a3a9011734754434e24cceda08b41b0c9ecad0ee9cf4bf5c2e07
6
+ metadata.gz: e99a231ea9c1066646624c1956c6bccc5ccf47b9e77768e9417c809b613777579593cad2798b2a91feae6e39094bbf5e09ca66ce9983d51b101ce49c15260c00
7
+ data.tar.gz: 4fbf4196185d3cc5aff17e145f0b821a782fa48131a70cf36eb956afd83b393e262237b21b19ecbc44620d311f06d74deca074028ab81294bea76fb5b5d21a90
data/README.md CHANGED
@@ -38,10 +38,13 @@ TwitterRequestHeaders.new(
38
38
 
39
39
  ## Minitest
40
40
 
41
- ```sh
42
- bundle install
43
- rake test
44
- ```
41
+ Install development dependencies:
42
+
43
+ $ bundle install
44
+
45
+ And run minitest:
46
+
47
+ $ rake test
45
48
 
46
49
  ## License
47
50
 
@@ -9,6 +9,16 @@ class TwitterRequestHeaders
9
9
  class << self
10
10
  attr_reader :consumer_key, :consumer_secret, :oauth_version, :oauth_cipher, :twitter_api
11
11
 
12
+ # Define Twitter application credentials and options to
13
+ # be accessible from rest of all library.
14
+ #
15
+ # @param consumer_key [String] Application ID/Key
16
+ # @param consumer_secret [String] Application Secret
17
+ # @param oauth_version [String, nil] OAuth version used by Twitter. See dashboard.
18
+ # @param oauth_cipher [String, nil] OAuth chipher used by Twitter. See API docs.
19
+ # @param twitter_api [String, nil] Twitter API address. See dashboard.
20
+ # @return [true]
21
+ #
12
22
  def configure(consumer_key, consumer_secret, oauth_version = nil, oauth_cipher = nil, twitter_api = nil)
13
23
  @consumer_key = consumer_key
14
24
  @consumer_secret = consumer_secret
@@ -21,7 +31,14 @@ class TwitterRequestHeaders
21
31
  end
22
32
  end
23
33
 
24
-
34
+ # Creates new session.
35
+ #
36
+ # @param oauth_token [String] Twitter OAuth Key
37
+ # @param oauth_secret [String] Twitter OAuth Secret
38
+ # @param request_verb [String] HTTP verb: GET, POST, e.g.
39
+ # @param request_path [String] HTTP request path. Like /users/blah/blah
40
+ # @param request_params [Hash, nil] HTTP request query. Like {user_id: 111222333}
41
+ #
25
42
  def initialize(oauth_token, oauth_secret, request_verb, request_path, request_params = nil)
26
43
  unless @@configured
27
44
  fail StandardError, "Call #{self.class}.configure first!"
@@ -38,6 +55,11 @@ class TwitterRequestHeaders
38
55
  @epochtime = epochtime
39
56
  end
40
57
 
58
+ # HTTP header of format:
59
+ # {'Authorization' => 'OAuth ...'}
60
+ #
61
+ # @return [Hash]
62
+ #
41
63
  def header
42
64
  signature = Signature.new(
43
65
  @oauth_token,
@@ -60,6 +82,9 @@ class TwitterRequestHeaders
60
82
  SecureRandom.hex(16)
61
83
  end
62
84
 
85
+ # Current unixtime (seconds)
86
+ # @return [String] 1446639000
87
+ #
63
88
  def epochtime
64
89
  Time.now.to_i.to_s
65
90
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "twitter-request-headers"
7
- spec.version = '0.0.11'
7
+ spec.version = '0.0.12'
8
8
  spec.authors = ["Dmitrii Komaritckii"]
9
9
  spec.email = ["lochnessathome@gmail.com"]
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter-request-headers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitrii Komaritckii