You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 1, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+35-30Lines changed: 35 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,27 @@
1
1
embedly
2
-
-------
2
+
=======
3
3
4
4
Embedly node client library. To find out what Embedly is all about, please
5
5
visit http://embed.ly.
6
6
7
-
News
8
-
^^^^
7
+
# News
8
+
9
9
10
10
* 05/04/2016 - The callback on object creation has been removed. Initialization
11
11
is now lazy and happens on the first API call. This is a breaking change if you
12
12
used a callback style constructor.
13
13
* The embedly-node modules has been updated and simplified. It is not backward
14
14
compatible. If you want to stick with the old API, use a verion < 1.0.
15
15
16
-
Prerequisites
17
-
^^^^^^^^^^^^^
16
+
# Prerequisites
17
+
18
18
19
19
* nodejs - Available in most package managers
20
20
*`npm <http://npmjs.org/>`_
21
21
22
22
23
-
Installing
24
-
^^^^^^^^^^
23
+
# Installing
24
+
25
25
26
26
To install the official latest stable version, please use npm::
27
27
@@ -33,11 +33,11 @@ If you would like cutting edge, then you can clone and install HEAD::
33
33
cd embedly-node
34
34
npm install
35
35
36
-
Getting Started
37
-
^^^^^^^^^^^^^^^
36
+
# Getting Started
38
37
39
38
Here are some examples *hint* replace xxxxxxxxxxx with real key::
40
39
40
+
```js
41
41
varEMBEDLY_KEY='xxxxxxxxxxxxxxxxxxxxxxxx';
42
42
43
43
var embedly =require('embedly'),
@@ -89,26 +89,27 @@ Here are some examples *hint* replace xxxxxxxxxxx with real key::
89
89
console.log('3. ');
90
90
console.log(util.inspect(objs[0]));
91
91
});
92
+
```
93
+
94
+
# Authentication
92
95
93
-
Authentication
94
-
^^^^^^^^^^^^^^
95
96
96
97
If a key is not specified, the EMBEDLY_KEY environmental variable will be
97
98
used. You can signup for an Embedly key at http://embed.ly. Support for
98
99
oauth will be added in a future version of the library.
99
100
100
-
Creating an api object
101
-
^^^^^^^^^^^^^^^^^^^^^^
101
+
# Creating an api object
102
+
102
103
103
104
The embedly exported prototype function takes an `Object` of optional
104
105
parameters to configure the Embedly API.
105
106
106
-
:key: Your Embedly consumer key.
107
-
:proto: The protocol to use when calling Embedly. The default is `http`.
107
+
`:key`: Your Embedly consumer key.
108
+
`:proto`: The protocol to use when calling Embedly. The default is `http`.
108
109
`https` is also valid.
109
-
:logger: An `Object` that has prototype functions `error` `warn` and `debug`
110
+
`:logger`: An `Object` that has prototype functions `error``warn` and `debug`
110
111
that can be invoked with a single string argument.
111
-
:servicesRegexp: A regular expression object to match urls against before
112
+
`:servicesRegexp`: A regular expression object to match urls against before
112
113
sending to the embedly API. Urls sent to an endpoint
113
114
that don't match will be returned as 401 errors.
114
115
@@ -117,8 +118,8 @@ parameter. It is possible in certain circumstances that the embedly api
117
118
will fail to initialize properly. Therefore it is recommended to use the
118
119
callback function and check for errors, like the example code above.
119
120
120
-
Endpoints
121
-
^^^^^^^^^
121
+
# Endpoints
122
+
122
123
123
124
Embedly api endpoints are implemented as prototype functions on the api object.
124
125
There are two endpoints implemented. See the Embedly API documentation for more
@@ -133,11 +134,12 @@ to canonize the parameters before sending them. Sending more than 20 URLs at
133
134
a time will fail. Future version of this library will batch requests of more
134
135
than 20 URLs into batches whose size will be configurable.
135
136
136
-
Logging
137
-
^^^^^^^
137
+
# Logging
138
+
138
139
139
140
`embedly-node` does provide some minimal logging to help diagnose problems. By default, a `winston` console logger with log level `error` will be created, but only if winston is installed. If you'd like more control over logging, you can create your own logger and pass it into embedly on instantiation. ex::
140
141
142
+
```js
141
143
var embedly =require('embedly'),
142
144
winston =require('winston'),
143
145
logger =new (winston.Logger)({
@@ -147,9 +149,10 @@ Logging
147
149
newembedly({logger: logger}, function(err, api) {
148
150
// do stuff with api
149
151
});
152
+
```
153
+
154
+
# Testing
150
155
151
-
Testing
152
-
^^^^^^^
153
156
154
157
We have provided some commandline tools to test the Embedly interface.
155
158
@@ -159,21 +162,23 @@ We have provided some commandline tools to test the Embedly interface.
159
162
Using --help with the commands should give you a good idea of how to use them.
160
163
161
164
162
-
Develop
163
-
^^^^^^^
165
+
# Develop
164
166
165
167
Run tests::
166
168
167
-
npm test
169
+
```bash
170
+
year test
171
+
```
168
172
169
173
Some tests will fail due to missing api key. Set the EMBEDLY_KEY environmental
170
174
variable with your key to get them to pass::
171
175
176
+
```
172
177
EMBEDLY_KEY=xxxxxxxxxxxxx npm test
178
+
```
173
179
180
+
# Note on Patches/Pull Requests
174
181
175
-
Note on Patches/Pull Requests
176
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
177
182
178
183
* Fork the project.
179
184
* Make your feature addition or bug fix.
@@ -183,7 +188,7 @@ Note on Patches/Pull Requests
183
188
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
184
189
* Send me a pull request. Bonus points for topic branches.
185
190
186
-
Copyright
187
-
^^^^^^^^^
191
+
# Copyright
192
+
188
193
189
194
Copyright (c) 2011 Embed.ly, Inc. See MIT-LICENSE for details.
0 commit comments