himtwiauth 0.1.3 → 0.2.0
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 +4 -4
- data/README.md +102 -3
- data/lib/himtwiauth.rb +2 -2
- data/lib/himtwiauth/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edf2f7d4ac784f485117ed471e2e887fe0ecb16d
|
4
|
+
data.tar.gz: 4503b772fc7986c863a24c6c653913fafed34e31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b5bfc827def093b1e83086977f340c8109edb8f61acc5eb73c2d1761c968023ab998f48e015e7ee24e896caa5df94ed3a0ba5d49f65f7f4cd6d78e78a5b3594
|
7
|
+
data.tar.gz: 534be0e7f8a0a0fbec7fa73db692abd8998de0e3747ccc7281d31f1b981b75c2a4dbf994d17ae0acf5c8908b09919d5c4f7cf6f9f98b8f796acd13c197a4bbc1
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Himtwiauth
|
2
2
|
|
3
|
-
|
3
|
+
Himtwiauth makes you easy to authentificate using gem (twitter)[https://github.com/sferik/twitter]
|
4
4
|
|
5
|
-
|
5
|
+
you don't have to write your API key in your code !
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,106 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
please require Himtwiauth
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'himtwiauth'
|
29
|
+
```
|
30
|
+
|
31
|
+
set your account, mode and path
|
32
|
+
|
33
|
+
if you want to use REST API, configuration follows
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
mode = 'REST'
|
37
|
+
```
|
38
|
+
|
39
|
+
or if you want to use Streaming API, configuration follows
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
mode = "Streaming"
|
43
|
+
```
|
44
|
+
|
45
|
+
please make password file (yaml)
|
46
|
+
|
47
|
+
* [reference](https://dev.twitter.com)
|
48
|
+
|
49
|
+
```yaml
|
50
|
+
# password.yaml
|
51
|
+
twitter:
|
52
|
+
screen_name : ""
|
53
|
+
consumer_key : ""
|
54
|
+
consumer_secret : ""
|
55
|
+
access_token : ""
|
56
|
+
access_token_secret : ""
|
57
|
+
```
|
58
|
+
|
59
|
+
for instance, your name is 'himkt', configuration follows
|
60
|
+
|
61
|
+
```yaml
|
62
|
+
# password.yaml
|
63
|
+
twitter: himkt
|
64
|
+
screen_name : "example"
|
65
|
+
consumer_key : "example"
|
66
|
+
consumer_secret : "example"
|
67
|
+
access_token : "example"
|
68
|
+
access_token_secret : "example"
|
69
|
+
```
|
70
|
+
|
71
|
+
and your account is 'himkt'. so
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
account = 'himkt'
|
75
|
+
```
|
76
|
+
|
77
|
+
last, please specify path to your password.yaml.
|
78
|
+
|
79
|
+
for instance, if your password.yaml is on '/Users/foo/Desktop', configuration follows
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
path = '/Users/foo/Desktop/password.yaml'
|
83
|
+
```
|
84
|
+
|
85
|
+
create client instance !
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
client = Himtwiauth.set_client(account, mode, path)
|
89
|
+
```
|
90
|
+
|
91
|
+
so far, your code is similar to
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
require 'himtwiauth'
|
95
|
+
mode = 'REST'
|
96
|
+
account = 'himkt'
|
97
|
+
path = '/Users/foo/Desktop/password.yaml'
|
98
|
+
client = Himtwiauth.set_client(account, mode, path)
|
99
|
+
```
|
100
|
+
|
101
|
+
you complete authentificate !
|
102
|
+
|
103
|
+
Examples
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
require 'himtwiauth'
|
107
|
+
mode = 'REST'
|
108
|
+
account = 'himkt'
|
109
|
+
path = '/Users/foo/Desktop/password.yaml'
|
110
|
+
client = Himtwiauth.set_client(account, mode, path)
|
111
|
+
|
112
|
+
client.update('test')
|
113
|
+
|
114
|
+
mode = 'Streaming'
|
115
|
+
client = Himtwiauth.set_client(account, mode, path)
|
116
|
+
|
117
|
+
p client
|
118
|
+
|
119
|
+
client.filter(locations: "-122.75,36.8,-121.75,37.8") do |tweet|
|
120
|
+
puts tweet.text
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
124
|
+
other examples [here](https://github.com/search?q=tw+user%3Ahimkt&ref=searchresults&type=Repositories&utf8=%E2%9C%93), please see.
|
26
125
|
|
27
126
|
## Development
|
28
127
|
|
data/lib/himtwiauth.rb
CHANGED
@@ -23,8 +23,8 @@ module Himtwiauth
|
|
23
23
|
config.access_token = pass[:access_token]
|
24
24
|
config.access_token_secret = pass[:access_token_secret]
|
25
25
|
end
|
26
|
-
elsif mode == '
|
27
|
-
client = Twitter::
|
26
|
+
elsif mode == 'Streaming'
|
27
|
+
client = Twitter::Streaming::Client.new do |config|
|
28
28
|
config.consumer_key = pass[:consumer_key]
|
29
29
|
config.consumer_secret = pass[:consumer_secret]
|
30
30
|
config.access_token = pass[:access_token]
|
data/lib/himtwiauth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: himtwiauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makoto Hiramatsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.4.5
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Test
|