milo 0.0.5.alpha → 0.0.6.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/milo/main.rb +1 -23
- data/lib/milo/version.rb +1 -1
- data/spec/milo/main_spec.rb +2 -7
- data/spec/milo/product_spec.rb +4 -4
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/milo/main.rb
CHANGED
@@ -10,29 +10,7 @@ module Milo
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def main_url
|
13
|
-
|
14
|
-
url_postfix = "api.x.com/milo/v3/"
|
15
|
-
url_prefix + url_postfix
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.to_json(function_name, input)
|
19
|
-
if input.is_a?(String)
|
20
|
-
input
|
21
|
-
else
|
22
|
-
input.to_json({:root => function_name})
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def params_list(list)
|
27
|
-
params = "?" + list.map do |k, v|
|
28
|
-
if v.is_a?(Array)
|
29
|
-
v.map do |val|
|
30
|
-
"#{k}[]=#{val}"
|
31
|
-
end.join("&")
|
32
|
-
else
|
33
|
-
"#{k}=#{v}"
|
34
|
-
end
|
35
|
-
end.join("&")
|
13
|
+
"https://api.x.com/milo/v3/"
|
36
14
|
end
|
37
15
|
|
38
16
|
def make_request(end_url)
|
data/lib/milo/version.rb
CHANGED
data/spec/milo/main_spec.rb
CHANGED
@@ -8,12 +8,7 @@ describe Milo::Main do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "basic" do
|
11
|
-
it "should have the correct mail_url
|
12
|
-
@milo.main_url.should == "http://api.x.com/milo/v3/"
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should have the correct mail_url with ssl options" do
|
16
|
-
@milo = Milo::Main.new(@key, :ssl => true)
|
11
|
+
it "should have the correct mail_url" do
|
17
12
|
@milo.main_url.should == "https://api.x.com/milo/v3/"
|
18
13
|
end
|
19
14
|
end
|
@@ -22,7 +17,7 @@ describe Milo::Main do
|
|
22
17
|
context "product" do
|
23
18
|
it "should construct url for product" do
|
24
19
|
response = @milo.make_request("products?product_ids=1234")
|
25
|
-
response.url.should == "
|
20
|
+
response.url.should == "https://api.x.com/milo/v3/products?product_ids=1234&key=#{@key}"
|
26
21
|
end
|
27
22
|
end
|
28
23
|
end
|
data/spec/milo/product_spec.rb
CHANGED
@@ -18,28 +18,28 @@ describe Milo::Main, 'product api' do
|
|
18
18
|
it "should be able to list all" do
|
19
19
|
milo = Milo::Main.new(@key)
|
20
20
|
response = milo.get_products
|
21
|
-
response.url.should == "
|
21
|
+
response.url.should == "https://api.x.com/milo/v3/products?key=#{@key}"
|
22
22
|
response.status.should == 200
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should be able to get by id" do
|
26
26
|
milo = Milo::Main.new(@key)
|
27
27
|
response = milo.get_product_by_id("20482374")
|
28
|
-
response.url.should == "
|
28
|
+
response.url.should == "https://api.x.com/milo/v3/products?product_ids=20482374&key=#{@key}"
|
29
29
|
response.status.should == 200
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should be able to get by upc" do
|
33
33
|
milo = Milo::Main.new(@key)
|
34
34
|
response = milo.get_product_by_upc("037000185062")
|
35
|
-
response.url.should == "
|
35
|
+
response.url.should == "https://api.x.com/milo/v3/products?q=upc:037000185062&key=#{@key}"
|
36
36
|
response.status.should == 200
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should be able to get by id with show flag in the show parameter" do
|
40
40
|
milo = Milo::Main.new(@key)
|
41
41
|
response = milo.get_product_by_id("20482374", show: "PnamePminUpcImg45")
|
42
|
-
response.url.should == "
|
42
|
+
response.url.should == "https://api.x.com/milo/v3/products?product_ids=20482374&show=PnamePminUpcImg45&key=#{@key}"
|
43
43
|
response.status.should == 200
|
44
44
|
end
|
45
45
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6.alpha
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
segments:
|
135
135
|
- 0
|
136
|
-
hash:
|
136
|
+
hash: 2932826454436237238
|
137
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|