social_net 0.1.1
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 +7 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +94 -0
- data/MIT-LICENSE +20 -0
- data/README.md +264 -0
- data/Rakefile +2 -0
- data/coverage/.last_run.json +5 -0
- data/coverage/.resultset.json +847 -0
- data/coverage/.resultset.json.lock +0 -0
- data/coverage/assets/0.9.0/application.css +799 -0
- data/coverage/assets/0.9.0/application.js +1707 -0
- data/coverage/assets/0.9.0/colorbox/border.png +0 -0
- data/coverage/assets/0.9.0/colorbox/controls.png +0 -0
- data/coverage/assets/0.9.0/colorbox/loading.gif +0 -0
- data/coverage/assets/0.9.0/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.9.0/favicon_green.png +0 -0
- data/coverage/assets/0.9.0/favicon_red.png +0 -0
- data/coverage/assets/0.9.0/favicon_yellow.png +0 -0
- data/coverage/assets/0.9.0/loading.gif +0 -0
- data/coverage/assets/0.9.0/magnify.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.9.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +5624 -0
- data/lib/social_net/facebook/api/configuration.rb +14 -0
- data/lib/social_net/facebook/api/request.rb +66 -0
- data/lib/social_net/facebook/config.rb +16 -0
- data/lib/social_net/facebook/errors/response_error.rb +14 -0
- data/lib/social_net/facebook/errors/unknown_user.rb +11 -0
- data/lib/social_net/facebook/errors.rb +2 -0
- data/lib/social_net/facebook/models/page.rb +49 -0
- data/lib/social_net/facebook/models/user.rb +66 -0
- data/lib/social_net/facebook/models.rb +2 -0
- data/lib/social_net/facebook.rb +11 -0
- data/lib/social_net/instagram/api/configuration.rb +13 -0
- data/lib/social_net/instagram/api/request.rb +63 -0
- data/lib/social_net/instagram/config.rb +16 -0
- data/lib/social_net/instagram/errors/response_error.rb +14 -0
- data/lib/social_net/instagram/errors/unknown_user.rb +11 -0
- data/lib/social_net/instagram/errors.rb +2 -0
- data/lib/social_net/instagram/models/user.rb +70 -0
- data/lib/social_net/instagram/models.rb +1 -0
- data/lib/social_net/instagram.rb +10 -0
- data/lib/social_net/twitter/api/configuration.rb +16 -0
- data/lib/social_net/twitter/api/request.rb +121 -0
- data/lib/social_net/twitter/config.rb +15 -0
- data/lib/social_net/twitter/errors/response_error.rb +14 -0
- data/lib/social_net/twitter/errors/suspended_user.rb +11 -0
- data/lib/social_net/twitter/errors/too_many_users.rb +11 -0
- data/lib/social_net/twitter/errors/unknown_user.rb +11 -0
- data/lib/social_net/twitter/errors.rb +4 -0
- data/lib/social_net/twitter/models/user.rb +81 -0
- data/lib/social_net/twitter/models.rb +1 -0
- data/lib/social_net/twitter.rb +11 -0
- data/lib/social_net/version.rb +3 -0
- data/lib/social_net.rb +7 -0
- data/social_net-0.1.0.gem +0 -0
- data/social_net.gemspec +30 -0
- data/spec/social_net/facebook/models/pages_spec.rb +42 -0
- data/spec/social_net/facebook/models/users_spec.rb +44 -0
- data/spec/social_net/instagram/models/user_spec.rb +50 -0
- data/spec/social_net/twitter/models/user_spec.rb +98 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/cassettes/SocialNet_Instagram_Models_User/_find_by/given_an_existing_case-insensitive_username/returns_an_object_representing_that_user.yml +106 -0
- data/spec/support/cassettes/SocialNet_Instagram_Models_User/_find_by/given_an_unknown_username/.yml +51 -0
- data/spec/support/cassettes/SocialNet_Instagram_Models_User/_find_by_/given_an_existing_case-insensitive_username/returns_an_object_representing_that_user.yml +106 -0
- data/spec/support/cassettes/SocialNet_Instagram_Models_User/_find_by_/given_an_unknown_username/.yml +51 -0
- data/spec/support/vcr.rb +22 -0
- metadata +245 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 26881d44493639d136df86db159bcb5d40efa27f
|
|
4
|
+
data.tar.gz: f2d57936c89e67e93d214ad47327753f644d32f3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9beafaaacab822d3c1aaf277514e80ac3d88b47903dc2730c0ca1bc808663fa8c6596ab35a77a727c90639c6802178cea090977a66bbe23e527cb92fae490d4d
|
|
7
|
+
data.tar.gz: 445b6d640dbc4a09347954b441f8d96b07d5065515643246f7d5314b958c664829539068eda8233a7ac6f99fa7ddaf0af736ea9e6fad67867149771f7140f92d
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
For more information about changelogs, check
|
|
6
|
+
[Keep a Changelog](http://keepachangelog.com) and
|
|
7
|
+
[Vandamme](http://tech-angels.github.io/vandamme).
|
|
8
|
+
|
|
9
|
+
## 0.1.0 - 2017-3-13
|
|
10
|
+
|
|
11
|
+
* Initial release with `Instagram::User` supporting `find_by`, `find_by!` and `where`.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
social_net (0.1.0)
|
|
5
|
+
activesupport
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
activesupport (5.0.2)
|
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
12
|
+
i18n (~> 0.7)
|
|
13
|
+
minitest (~> 5.1)
|
|
14
|
+
tzinfo (~> 1.1)
|
|
15
|
+
addressable (2.5.0)
|
|
16
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
|
17
|
+
concurrent-ruby (1.0.5)
|
|
18
|
+
coveralls (0.7.12)
|
|
19
|
+
multi_json (~> 1.10)
|
|
20
|
+
rest-client (>= 1.6.8, < 2)
|
|
21
|
+
simplecov (~> 0.9.1)
|
|
22
|
+
term-ansicolor (~> 1.3)
|
|
23
|
+
thor (~> 0.19.1)
|
|
24
|
+
crack (0.4.3)
|
|
25
|
+
safe_yaml (~> 1.0.0)
|
|
26
|
+
diff-lcs (1.3)
|
|
27
|
+
docile (1.1.5)
|
|
28
|
+
domain_name (0.5.20170223)
|
|
29
|
+
unf (>= 0.0.5, < 1.0.0)
|
|
30
|
+
hashdiff (0.3.2)
|
|
31
|
+
http-cookie (1.0.3)
|
|
32
|
+
domain_name (~> 0.5)
|
|
33
|
+
i18n (0.8.1)
|
|
34
|
+
mime-types (2.99.3)
|
|
35
|
+
minitest (5.10.1)
|
|
36
|
+
multi_json (1.12.1)
|
|
37
|
+
netrc (0.11.0)
|
|
38
|
+
public_suffix (2.0.5)
|
|
39
|
+
rake (10.5.0)
|
|
40
|
+
rest-client (1.8.0)
|
|
41
|
+
http-cookie (>= 1.0.2, < 2.0)
|
|
42
|
+
mime-types (>= 1.16, < 3.0)
|
|
43
|
+
netrc (~> 0.7)
|
|
44
|
+
rspec (3.5.0)
|
|
45
|
+
rspec-core (~> 3.5.0)
|
|
46
|
+
rspec-expectations (~> 3.5.0)
|
|
47
|
+
rspec-mocks (~> 3.5.0)
|
|
48
|
+
rspec-core (3.5.4)
|
|
49
|
+
rspec-support (~> 3.5.0)
|
|
50
|
+
rspec-expectations (3.5.0)
|
|
51
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
52
|
+
rspec-support (~> 3.5.0)
|
|
53
|
+
rspec-mocks (3.5.0)
|
|
54
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
55
|
+
rspec-support (~> 3.5.0)
|
|
56
|
+
rspec-support (3.5.0)
|
|
57
|
+
safe_yaml (1.0.4)
|
|
58
|
+
simplecov (0.9.2)
|
|
59
|
+
docile (~> 1.1.0)
|
|
60
|
+
multi_json (~> 1.0)
|
|
61
|
+
simplecov-html (~> 0.9.0)
|
|
62
|
+
simplecov-html (0.9.0)
|
|
63
|
+
term-ansicolor (1.4.0)
|
|
64
|
+
tins (~> 1.0)
|
|
65
|
+
thor (0.19.4)
|
|
66
|
+
thread_safe (0.3.6)
|
|
67
|
+
tins (1.13.2)
|
|
68
|
+
tzinfo (1.2.2)
|
|
69
|
+
thread_safe (~> 0.1)
|
|
70
|
+
unf (0.1.4)
|
|
71
|
+
unf_ext
|
|
72
|
+
unf_ext (0.0.7.2)
|
|
73
|
+
vcr (2.9.3)
|
|
74
|
+
webmock (1.24.6)
|
|
75
|
+
addressable (>= 2.3.6)
|
|
76
|
+
crack (>= 0.3.2)
|
|
77
|
+
hashdiff
|
|
78
|
+
yard (0.8.7.6)
|
|
79
|
+
|
|
80
|
+
PLATFORMS
|
|
81
|
+
ruby
|
|
82
|
+
|
|
83
|
+
DEPENDENCIES
|
|
84
|
+
bundler (~> 1.6)
|
|
85
|
+
coveralls (~> 0.7.1)
|
|
86
|
+
rake (~> 10.3)
|
|
87
|
+
rspec (~> 3.1)
|
|
88
|
+
social_net!
|
|
89
|
+
vcr (~> 2.9)
|
|
90
|
+
webmock (~> 1.19)
|
|
91
|
+
yard (~> 0.8.7)
|
|
92
|
+
|
|
93
|
+
BUNDLED WITH
|
|
94
|
+
1.10.6
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2017 Collab, Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
SocialNet - a Ruby client for social networks API
|
|
2
|
+
===========================================
|
|
3
|
+
|
|
4
|
+
SocialNet helps you write apps that need to interact with Twitter, Instagram and Facebook.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
After [configuring your Twitter app](#configuring-your-twitter-app), you can run commands like:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
user = SocialNet::Twitter::User.find_by screen_name: 'collab'
|
|
11
|
+
user.screen_name #=> "Collab"
|
|
12
|
+
user.follower_count #=> 48_200
|
|
13
|
+
```
|
|
14
|
+
After [configuring your Instagram app](#configuring-your-instagram-app), you can run commands like:
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
user = SocialNet::Instagram::User.find_by username: 'Collab'
|
|
18
|
+
user.username #=> "Collab"
|
|
19
|
+
user.follower_count #=> 7025
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
After [configuring your Facebook app](#configuring-your-facebook-app), you can run commands like:
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
page = SocialNet::Facebook::Page.find_by username: 'collab'
|
|
26
|
+
page.username #=> "collab"
|
|
27
|
+
page.likes #=> 30094
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
How to install
|
|
31
|
+
==============
|
|
32
|
+
|
|
33
|
+
To install on your system, run
|
|
34
|
+
|
|
35
|
+
gem install net
|
|
36
|
+
|
|
37
|
+
To use inside a bundled Ruby project, add this line to the Gemfile:
|
|
38
|
+
|
|
39
|
+
gem 'social_net', '~> 0.1.0'
|
|
40
|
+
|
|
41
|
+
Since the gem follows [Semantic Versioning](http://semver.org),
|
|
42
|
+
indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
|
|
43
|
+
guarantees that your project won’t occur in any error when you `bundle update`
|
|
44
|
+
and a new version of SocialNet is released.
|
|
45
|
+
|
|
46
|
+
Available resources
|
|
47
|
+
===================
|
|
48
|
+
|
|
49
|
+
SocialNet::Twitter::User
|
|
50
|
+
------------------
|
|
51
|
+
|
|
52
|
+
Use [SocialNet::Twitter::User]() to:
|
|
53
|
+
|
|
54
|
+
* retrieve a Twitter user by screen name
|
|
55
|
+
* retrieve a list of Twitter users by screen names
|
|
56
|
+
* access the number of followers of a Twitter user
|
|
57
|
+
|
|
58
|
+
```ruby
|
|
59
|
+
user = SocialNet::Twitter::User.find_by screen_name: 'collab'
|
|
60
|
+
user.follower_count #=> 48_200
|
|
61
|
+
|
|
62
|
+
users = SocialNet::Twitter::User.where screen_name: ['collab', 'brohemian6']
|
|
63
|
+
users.map(&:follower_count).sort #=> [12, 48_200]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
*The methods above require a configured Twitter app (see below).*
|
|
67
|
+
|
|
68
|
+
SocialNet::Instagram::User
|
|
69
|
+
--------------------
|
|
70
|
+
|
|
71
|
+
Use [SocialNet::Instagram::User]() to:
|
|
72
|
+
|
|
73
|
+
* retrieve an Instagram user by username
|
|
74
|
+
* retrieve an Instagram user by id
|
|
75
|
+
* access the number of followers of an Instagram user
|
|
76
|
+
|
|
77
|
+
```ruby
|
|
78
|
+
user = SocialNet::Instagram::User.find_by username: 'collab'
|
|
79
|
+
user.follower_count #=> 24198
|
|
80
|
+
|
|
81
|
+
user = SocialNet::Instagram::User.find_by id: 270587948
|
|
82
|
+
user.follower_count #=> 24198
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
*The methods above require a configured Instagram app (see below).*
|
|
86
|
+
|
|
87
|
+
SocialNet::Facebook::Page
|
|
88
|
+
--------------------
|
|
89
|
+
|
|
90
|
+
Use [SocialNet::Facebook::Page]() to:
|
|
91
|
+
|
|
92
|
+
* retrieve a Facebook page by username
|
|
93
|
+
* access the number of likes of a Facebook user
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
page = SocialNet::Facebook::Page.find_by username: 'collab'
|
|
97
|
+
page.likes #=> 7025
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
SocialNet::Facebook::User
|
|
101
|
+
--------------------
|
|
102
|
+
|
|
103
|
+
Use [SocialNet::Facebook::User]() to:
|
|
104
|
+
|
|
105
|
+
* retrieve a Facebook user by username
|
|
106
|
+
|
|
107
|
+
```ruby
|
|
108
|
+
user = SocialNet::Facebook::User.find_by username: '10100829454613149'
|
|
109
|
+
user.first_name #=> Jeremy
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
* Include a Facebook access_token parameter in order to access pages information for a certain user
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
user = SocialNet::Facebook::User.find_by username: '10100829454613149', access_token: 'abc123'
|
|
116
|
+
user.pages #=> [{"name"=>"Jeremy Video Game", "id"=>"1627249647512991"}, {"name"=>"Influencer Plus", "id"=>"629655227132365"}]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
*The methods above require a configured Facebook app (see below).*
|
|
120
|
+
|
|
121
|
+
Configuring your Twitter app
|
|
122
|
+
============================
|
|
123
|
+
|
|
124
|
+
In order to use SocialNet you must create an app in the [Twitter Application Manager](https://apps.twitter.com/app/new).
|
|
125
|
+
|
|
126
|
+
Once the app is created, copy the API key and secret and add them to your
|
|
127
|
+
code with the following snippet of code (replacing with your own key and secret)
|
|
128
|
+
:
|
|
129
|
+
|
|
130
|
+
```ruby
|
|
131
|
+
SocialNet::Twitter.configure do |config|
|
|
132
|
+
config.apps.push key: 'abcd', secret: 'efgh'
|
|
133
|
+
end
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Configuring with environment variables
|
|
137
|
+
--------------------------------------
|
|
138
|
+
|
|
139
|
+
As an alternative to the approach above, you can configure your app with
|
|
140
|
+
variables. Setting the following environment variables:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
export TWITTER_API_KEY='abcd'
|
|
144
|
+
export TWITTER_API_SECRET='efgh'
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
is equivalent to configuring your app with the initializer:
|
|
148
|
+
|
|
149
|
+
```ruby
|
|
150
|
+
SocialNet::Twitter.configure do |config|
|
|
151
|
+
config.apps.push key: 'abcd', secret: 'efgh'
|
|
152
|
+
end
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
so use the approach that you prefer.
|
|
156
|
+
If a variable is set in both places, then `SocialNet::Twitter.configure` takes precedence.
|
|
157
|
+
|
|
158
|
+
Configuring your Instagram app
|
|
159
|
+
============================
|
|
160
|
+
|
|
161
|
+
In order to use SocialNet you must create an app in the
|
|
162
|
+
[Instagram Client Manager](http://instagram.com/developer/clients/register).
|
|
163
|
+
|
|
164
|
+
Once the app is created, copy the Client ID and add it to your
|
|
165
|
+
code with the following snippet of code (replacing with your own client id)
|
|
166
|
+
:
|
|
167
|
+
|
|
168
|
+
```ruby
|
|
169
|
+
SocialNet::Instagram.configure do |config|
|
|
170
|
+
config.client_id = 'abcdefg'
|
|
171
|
+
end
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Configuring with environment variables
|
|
175
|
+
--------------------------------------
|
|
176
|
+
|
|
177
|
+
As an alternative to the approach above, you can configure your app with
|
|
178
|
+
a variable. Setting the following environment variable:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
export INSTAGRAM_CLIENT_ID='abcdefg'
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
is equivalent to configuring your app with the initializer:
|
|
185
|
+
|
|
186
|
+
```ruby
|
|
187
|
+
SocialNet::Instagram.configure do |config|
|
|
188
|
+
config.client_id = 'abcdefg'
|
|
189
|
+
end
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
so use the approach that you prefer.
|
|
193
|
+
If a variable is set in both places, then `SocialNet::Instagram.configure` takes precedence.
|
|
194
|
+
|
|
195
|
+
Configuring your Facebook app
|
|
196
|
+
============================
|
|
197
|
+
|
|
198
|
+
In order to use SocialNet you must create an app in the [Facebook Application Manager](https://developers.facebook.com/apps/).
|
|
199
|
+
|
|
200
|
+
Once the app is created, copy the API key and secret and add them to your
|
|
201
|
+
code with the following snippet of code (replacing with your own key and secret)
|
|
202
|
+
:
|
|
203
|
+
|
|
204
|
+
```ruby
|
|
205
|
+
SocialNet::Facebook.configure do |config|
|
|
206
|
+
config.client_id = 'abcdefg'
|
|
207
|
+
config.client_secret = 'abcdefg'
|
|
208
|
+
end
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Configuring with environment variables
|
|
212
|
+
--------------------------------------
|
|
213
|
+
|
|
214
|
+
As an alternative to the approach above, you can configure your app with
|
|
215
|
+
variables. Setting the following environment variables:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
export FACEBOOK_CLIENT_ID='abcd'
|
|
219
|
+
export FACEBOOK_CLIENT_SECRET='efgh'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
is equivalent to configuring your app with the initializer:
|
|
223
|
+
|
|
224
|
+
```ruby
|
|
225
|
+
SocialNet::Facebook.configure do |config|
|
|
226
|
+
config.client_id = 'abcd'
|
|
227
|
+
config.client_secret = 'efgh'
|
|
228
|
+
end
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
so use the approach that you prefer.
|
|
232
|
+
If a variable is set in both places, then `SocialNet::Facebook.configure` takes precedence.
|
|
233
|
+
|
|
234
|
+
How to test
|
|
235
|
+
===========
|
|
236
|
+
|
|
237
|
+
To run tests, type:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
rspec
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
SocialNet uses [VCR](https://github.com/vcr/vcr) so by default tests do not run
|
|
244
|
+
HTTP requests.
|
|
245
|
+
|
|
246
|
+
If you need to run tests against the live Twitter API or Instagram API,
|
|
247
|
+
configure your [Twitter app](#configuring-your-twitter-app) or your [Instagram app](#configuring-your-instagram-app) using environment variables,
|
|
248
|
+
erase the cassettes, then run `rspec`.
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
How to release new versions
|
|
252
|
+
===========================
|
|
253
|
+
|
|
254
|
+
If you are a manager of this project, remember to upgrade the [SocialNet gem](http://rubygems.org/gems/net)
|
|
255
|
+
whenever a new feature is added or a bug gets fixed.
|
|
256
|
+
|
|
257
|
+
Make sure all the tests are passing, document the changes in CHANGELOG.md and
|
|
258
|
+
README.md, bump the version, then run
|
|
259
|
+
|
|
260
|
+
rake release
|
|
261
|
+
|
|
262
|
+
Remember that the net gem follows [Semantic Versioning](http://semver.org).
|
|
263
|
+
Any new release that is fully backward-compatible should bump the *patch* version (0.1.x).
|
|
264
|
+
Any new version that breaks compatibility should bump the *minor* version (0.x.0)
|
data/Rakefile
ADDED