milkman 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f70e86ed17fee9abd767258828429e32331dc7e
4
- data.tar.gz: 041527d2354dcb3677e501db286f68e6b5fed53d
3
+ metadata.gz: ed084fc316eb5e7092bc447b6784b49cb4761bc6
4
+ data.tar.gz: 87a261589670a17d73fd7bc78502bbbc8bb9231a
5
5
  SHA512:
6
- metadata.gz: d22bc948d10b6db10cb2a230315d14b802658d7b7a1912db053a28cc515597eb1a462839e2f7832cabcecfc9c0b68812404d25ed4040bf286821ed3c931a40d1
7
- data.tar.gz: 95221cd07e2073ff65c43c0e84103bb55046d4791f00fa5e2be8c08089129b5330cf95e68edc22310ad3568d52d85650f7e3591823dc335b0f0085dfc0a5231d
6
+ metadata.gz: e88fc8802a1c97541aafe654951f551e6fc2de6a85b3335d745e4b5473fc5985e8e155f6f76d1bd6363e7b5e658246dd9603f9374521fd5846b9e0504f3165f6
7
+ data.tar.gz: dce35f2574c2bd334e27f859a9bff04291cc9734db74dba722f183c547b327eb52ba83a2c5b1aa16d99d74bd57b6925d84219c1c5fc7872185eec7b99232db99
data/lib/milkman.rb CHANGED
@@ -2,7 +2,7 @@ require "i18n"
2
2
 
3
3
  module Milkman
4
4
 
5
- AUTH_URL = "http://www.rememberthemilk.com/services/auth/"
5
+ AUTH_URL = "https://www.rememberthemilk.com/services/auth/"
6
6
  BASE_URL = "http://api.rememberthemilk.com/services/rest/"
7
7
 
8
8
  I18n.load_path += Dir.glob(File.join(File.dirname(__FILE__), "locales/*.yml"))
@@ -3,10 +3,11 @@ module Milkman
3
3
 
4
4
  include Utility
5
5
 
6
- attr_accessor :options
6
+ attr_accessor :options, :shared_secret
7
7
 
8
8
  def initialize(attributes)
9
- @options = attributes.merge! default_options
9
+ @shared_secret = attributes.delete(:shared_secret)
10
+ @options = attributes.merge! default_options
10
11
  end
11
12
 
12
13
  def self.authorize(options)
@@ -15,7 +16,7 @@ module Milkman
15
16
 
16
17
  def authorize
17
18
  puts I18n.t("milkman.authorization.frob_message", url: frob_message_url)
18
- puts I18n.t("milkman.authorization.auth_token_message", username: response["rsp"]["auth"]["user"]["username"], api_key: options[:api_key], shared_secret: options[:shared_secret], auth_token: response["rsp"]["auth"]["token"])
19
+ puts I18n.t("milkman.authorization.auth_token_message", username: response["rsp"]["auth"]["user"]["username"], api_key: options[:api_key], shared_secret: shared_secret, auth_token: response["rsp"]["auth"]["token"])
19
20
  end
20
21
 
21
22
  private
@@ -25,7 +26,7 @@ module Milkman
25
26
  end
26
27
 
27
28
  def signed_options
28
- sign options[:shared_secret], options.merge!(method: "rtm.auth.getToken", frob: frob)
29
+ sign shared_secret, options.merge!(method: "rtm.auth.getToken", frob: frob)
29
30
  end
30
31
 
31
32
  def frob
@@ -33,7 +34,7 @@ module Milkman
33
34
  end
34
35
 
35
36
  def frob_message_url
36
- authorization_url sign(options[:shared_secret], options)
37
+ authorization_url sign(shared_secret, options.except(:format))
37
38
  end
38
39
 
39
40
  def authorization_url(parameters)
@@ -3,10 +3,11 @@ module Milkman
3
3
 
4
4
  include Utility
5
5
 
6
- attr_accessor :options
6
+ attr_accessor :options, :shared_secret
7
7
 
8
8
  def initialize(attributes)
9
- @options = attributes.merge default_options
9
+ @shared_secret = attributes.delete(:shared_secret)
10
+ @options = attributes.merge default_options
10
11
 
11
12
  if !has_required_options?
12
13
  raise NoMilkError, "The API key and shared secret are required."
@@ -14,14 +15,14 @@ module Milkman
14
15
  end
15
16
 
16
17
  def get(method, request_options = {})
17
- signed_options = sign options[:shared_secret], options.merge!(method: method).merge!(request_options)
18
+ signed_options = sign shared_secret, options.merge!(method: method).merge!(request_options)
18
19
  Milkman::Request.call request_url(signed_options)
19
20
  end
20
21
 
21
22
  private
22
23
 
23
24
  def has_required_options?
24
- options[:api_key] && options[:shared_secret]
25
+ options[:api_key] && shared_secret
25
26
  end
26
27
 
27
28
  end
@@ -1,3 +1,3 @@
1
1
  module Milkman
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -8,11 +8,14 @@ module Milkman
8
8
  end
9
9
 
10
10
  context "#initialize" do
11
+ let(:client) { described_class.new(options) }
11
12
 
12
- it "saves a references to the specified options" do
13
- hash = { api_key: "<api_key>", shared_secret: "<shared_secret>", format: "json", perms: "delete" }
13
+ it "knows its shared secret" do
14
+ expect(client.shared_secret).to eq "<shared_secret>"
15
+ end
14
16
 
15
- client = described_class.new(options)
17
+ it "saves a references to the specified options" do
18
+ hash = { api_key: "<api_key>", format: "json", perms: "delete" }
16
19
  expect(client.options).to eq hash
17
20
  end
18
21
 
@@ -8,11 +8,15 @@ module Milkman
8
8
  end
9
9
 
10
10
  context "#initialize" do
11
+ let(:client) { described_class.new(options) }
12
+
13
+ it "knows its shared secret" do
14
+ expect(client.shared_secret).to eq "bar"
15
+ end
11
16
 
12
17
  it "saves a references to the specified options" do
13
- hash = { api_key: "foo", shared_secret: "bar", format: "json", perms: "delete" }
18
+ hash = { api_key: "foo", format: "json", perms: "delete" }
14
19
 
15
- client = described_class.new(options)
16
20
  expect(client.options).to eq hash
17
21
  end
18
22
 
@@ -62,7 +66,7 @@ module Milkman
62
66
  context "#get" do
63
67
 
64
68
  it "requests a call to the RTM API with the specified method" do
65
- expect(Milkman::Request).to receive(:call).with "http://api.rememberthemilk.com/services/rest/?api_key=foo&shared_secret=bar&perms=delete&format=json&method=method&api_sig=57c35d820267ab89717e291d619860d2"
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=7c861e6ffbe0ce450cdfcc68f7447753"
66
70
 
67
71
  client = described_class.new(options)
68
72
  client.get "method"
data/spec/milkman_spec.rb CHANGED
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe Milkman do
4
4
 
5
5
  it "knows its AUTH_URL" do
6
- expect(Milkman::AUTH_URL).to eq "http://www.rememberthemilk.com/services/auth/"
6
+ expect(Milkman::AUTH_URL).to eq "https://www.rememberthemilk.com/services/auth/"
7
7
  end
8
8
 
9
9
  it "knows its BASE_URL" do
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milkman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Tuhumury
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-25 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: i18n
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: httparty
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: capture_stdout
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: coveralls
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: This gem provides a Ruby wrapper around the Remember The Milk (RTM) API
@@ -145,11 +145,11 @@ executables:
145
145
  extensions: []
146
146
  extra_rdoc_files: []
147
147
  files:
148
- - ".coveralls.yml"
149
- - ".gitignore"
150
- - ".ruby-gemset"
151
- - ".ruby-version"
152
- - ".travis.yml"
148
+ - .coveralls.yml
149
+ - .gitignore
150
+ - .ruby-gemset
151
+ - .ruby-version
152
+ - .travis.yml
153
153
  - Gemfile
154
154
  - LICENSE.txt
155
155
  - README.md
@@ -181,17 +181,17 @@ require_paths:
181
181
  - lib
182
182
  required_ruby_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
- - - ">="
184
+ - - '>='
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - ">="
189
+ - - '>='
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.4.3
194
+ rubygems_version: 2.0.14.1
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Milkman is a Ruby wrapper for the Remember The Milk (RTM) API.