milkman 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +9 -5
- data/lib/milkman.rb +3 -2
- data/lib/milkman/utility.rb +1 -1
- data/lib/milkman/version.rb +1 -1
- data/spec/milkman/authorizer_spec.rb +1 -1
- data/spec/milkman/client_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcbe00c8902d41030eeabf7211e8da5dd205f608
|
4
|
+
data.tar.gz: d7366b2f124299abc54ae0e38c0c398e5c0b1f8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5d97cf0c80ca1faa7f751d80b5523e972b9aa4fd60f7d5a2a547764f56f82c4c03a029672ed8261ea0f9bd7c370a50bfd7627d18e7636c2fc6ab2550ebd084
|
7
|
+
data.tar.gz: 022e74eaf5deaacfb6b2c20846836e6a618c7cf1014582b52989eaa056feba9d1fc3743998a97e6da6b660b27d407e026db2313d2fe2e99bcaec13379bfdda67
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -33,12 +33,12 @@ You can retrieve an API key and shared secret from the official Remember The Mil
|
|
33
33
|
### Run the `milkman` executable
|
34
34
|
|
35
35
|
milkman authorize API_KEY SHARED_SECRET
|
36
|
-
|
36
|
+
|
37
37
|
Something like the following will be shown to you:
|
38
38
|
|
39
39
|
Copy the URL below and follow the steps on Remember The Milk (RTM) to authorize Milkman:
|
40
40
|
|
41
|
-
|
41
|
+
https://www.rememberthemilk.com/services/auth/?api_key=API_KEY&perms=read&format=json&v=2&api_sig=08da0d11ef239318027364133ac1a644
|
42
42
|
|
43
43
|
Once you've authorized Milkman, you'll receive a hash called 'frob' from Remember The Milk. The page from Remember The Milk will list something like the following: 'No callback URL specified for this API key. Your frob value is YOUR_FROB'. Copy and paste that YOUR_FROB value below and press <enter>:
|
44
44
|
|
@@ -48,12 +48,16 @@ Copy the URL (as requested) and paste it in your browser. Next copy the frob fro
|
|
48
48
|
|
49
49
|
Both the auth token, API key and shared secret are listed below. Save them using one of the methods above (or perhaps another solution) as you'll need all of them to use Milkman in your own project. Oh, and Remember... The Milk!
|
50
50
|
|
51
|
-
|
51
|
+
api_key: API_KEY
|
52
52
|
shared_secret: SHARED_SECRET
|
53
53
|
auth_token: AUTH_TOKEN
|
54
54
|
|
55
55
|
Take note of the variables and save them, since you'll need them to use Milkman.
|
56
56
|
|
57
|
+
## Remember The Milk API version
|
58
|
+
|
59
|
+
From Milkman version 0.0.5 and onwards Milkman will use RTM API version 2 by default.
|
60
|
+
|
57
61
|
## Using Milkman
|
58
62
|
|
59
63
|
Using Milkman is easy. All you need to know is that all calls go through the `Milkman::Client` class. Specifically it's `get` method. Let's say you want to retrieve all your tasks from RTM. Well, there's a method for that and it's called: `rtm.tasks.getList`. More information about that method can be found [here](https://www.rememberthemilk.com/services/api/methods/rtm.tasks.getList.rtm).
|
@@ -65,7 +69,7 @@ In order to retrieve the above information, we'll need an instance of the Milkma
|
|
65
69
|
```ruby
|
66
70
|
client = Milkman::Client.new api_key: API_KEY, shared_secret: SHARED_SECRET, auth_token: AUTH_TOKEN
|
67
71
|
```
|
68
|
-
|
72
|
+
|
69
73
|
That's it.
|
70
74
|
|
71
75
|
### Milking the cow, err... Calling our method
|
@@ -75,7 +79,7 @@ Now, let's call our `rtm.tasks.getList` method:
|
|
75
79
|
```ruby
|
76
80
|
client.get "rtm.tasks.getList"
|
77
81
|
```
|
78
|
-
|
82
|
+
|
79
83
|
The above call will return every task you have. As can be seen on the [API page](https://www.rememberthemilk.com/services/api/methods/rtm.tasks.getList.rtm) of the above method, there are a couple of optional parameters, like `list_id`, `filter` and `last_sync`. These can be used as follows:
|
80
84
|
|
81
85
|
```ruby
|
data/lib/milkman.rb
CHANGED
@@ -2,8 +2,9 @@ require "i18n"
|
|
2
2
|
|
3
3
|
module Milkman
|
4
4
|
|
5
|
-
AUTH_URL
|
6
|
-
BASE_URL
|
5
|
+
AUTH_URL = "https://www.rememberthemilk.com/services/auth/"
|
6
|
+
BASE_URL = "http://api.rememberthemilk.com/services/rest/"
|
7
|
+
API_VERSION = 2
|
7
8
|
|
8
9
|
I18n.load_path += Dir.glob(File.join(File.dirname(__FILE__), "locales/*.yml"))
|
9
10
|
|
data/lib/milkman/utility.rb
CHANGED
data/lib/milkman/version.rb
CHANGED
@@ -15,7 +15,7 @@ module Milkman
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "saves a references to the specified options" do
|
18
|
-
hash = { api_key: "<api_key>", format: "json", perms: "delete" }
|
18
|
+
hash = { api_key: "<api_key>", format: "json", perms: "delete", v: 2 }
|
19
19
|
expect(client.options).to eq hash
|
20
20
|
end
|
21
21
|
|
data/spec/milkman/client_spec.rb
CHANGED
@@ -15,7 +15,7 @@ module Milkman
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "saves a references to the specified options" do
|
18
|
-
hash = { api_key: "foo", format: "json", perms: "delete" }
|
18
|
+
hash = { api_key: "foo", format: "json", perms: "delete", v: 2 }
|
19
19
|
|
20
20
|
expect(client.options).to eq hash
|
21
21
|
end
|
@@ -66,7 +66,7 @@ module Milkman
|
|
66
66
|
context "#get" do
|
67
67
|
|
68
68
|
it "requests a call to the RTM API with the specified method" do
|
69
|
-
expect(Milkman::Request).to receive(:call).with "http://api.rememberthemilk.com/services/rest/?api_key=foo&perms=delete&format=json&method=method&api_sig=
|
69
|
+
expect(Milkman::Request).to receive(:call).with "http://api.rememberthemilk.com/services/rest/?api_key=foo&perms=delete&format=json&v=2&method=method&api_sig=095631780dd0429ec5a8389f89b97cb3"
|
70
70
|
|
71
71
|
client = described_class.new(options)
|
72
72
|
client.get "method"
|