milo 0.0.6.alpha → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v.0.06
2
+
3
+ * get products
4
+ * show flag option
5
+
1
6
  ## v.0.0.3
2
7
 
3
8
  * get products
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- milo (0.0.6.alpha)
4
+ milo (0.0.6)
5
5
  activesupport
6
6
  crack
7
7
  curb
data/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  ## Description
7
7
 
8
8
  Track in real time the price and availability of every product carried by every location of every merchant through eBay Milo API.
9
+ More info about eBay Milo API https://www.x.com/developers/documentation-tools/milo/endpoints.html
9
10
 
10
11
  ## Installation
11
12
 
@@ -23,7 +24,28 @@ Or install it yourself as:
23
24
 
24
25
  ## Usage
25
26
 
26
- TODO: Write usage instructions here
27
+ First:
28
+
29
+ milo = Milo::Main.new("ec17621f92c4b199a7a041bfe27a0c00")
30
+
31
+ Get all products:
32
+
33
+ milo.get_products
34
+
35
+ Get product by id:
36
+
37
+ milo.get_product_by_id("20482374")
38
+
39
+ Get product by upc code:
40
+
41
+ milo.get_product_by_upc("037000185062")
42
+
43
+ More complex, find by id and pass show options for products:
44
+
45
+ milo.get_product_by_id("20482374", show: "PnamePminUpcImg45")
46
+
47
+ Note: Read about show flag here -> https://www.x.com/developers/documentation-tools/milo/endpoints.html#products-endpoint
48
+
27
49
 
28
50
  ## Contributing to Milo
29
51
 
data/lib/milo/main.rb CHANGED
@@ -1,12 +1,11 @@
1
1
  module Milo
2
2
  class Main
3
- attr_accessor :main_url, :format
3
+ attr_accessor :main_url
4
4
  attr_reader :response_raw, :response
5
5
 
6
6
  def initialize(key, options = {})
7
7
  @key = key
8
8
  @options = options
9
- @format = 'json'
10
9
  end
11
10
 
12
11
  def main_url
@@ -15,20 +14,14 @@ module Milo
15
14
 
16
15
  def make_request(end_url)
17
16
  result_key = end_url.include?("?") ? "&key=#{@key}" : "?key=#{@key}"
18
- curl = Curl::Easy.new(main_url + end_url + result_key)
19
-
20
- if curl.body_str == "<error>A friendly explanation of what went wrong</error>"
21
- return "string" #raise CouldNotAuthenticateYou
22
- end
23
- Response.new(curl, format)
17
+ curl = Curl::Easy.perform(main_url + end_url + result_key)
18
+ Response.new(curl)
24
19
  end
25
20
 
26
21
  class Response
22
+ attr_reader :status, :body, :headers_raw, :headers, :curl, :url
27
23
 
28
- attr_reader :status, :body, :headers_raw, :headers, :curl, :url, :data
29
-
30
- def initialize(curl, format)
31
- @format=format
24
+ def initialize(curl)
32
25
  @curl = curl
33
26
  @url = curl.url
34
27
  @status = curl.response_code
@@ -49,7 +42,6 @@ module Milo
49
42
  end
50
43
  @headers=hs
51
44
  end
52
-
53
45
  end
54
46
 
55
47
  include Milo::Product
data/lib/milo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Milo
2
- VERSION = "0.0.6.alpha"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -11,6 +11,7 @@ describe Milo::Main, 'product api' do
11
11
  curl.stub!(:perform)
12
12
  curl.stub!(:header_str) { "\r\ntest: blah"}
13
13
  curl.stub!(:response_code).and_return(200)
14
+ curl.stub!(:body_str).and_return("{\"pagination\": {\"total_results\": 1, \"per_page\": 30, \"total_pages\": 1, \"page\": 0}, \"products\": [{\"merchants\": [4483], \"min_price\": null, \"name\": \"REDI2SET 43\\\" x 14\\\" Wavy Glass Pattern Frameless Replacement Glass Block Window\", \"max_price\": null, \"product_id\": 20482374}]}")
14
15
  curl
15
16
  end
16
17
  end
@@ -26,6 +27,7 @@ describe Milo::Main, 'product api' do
26
27
  milo = Milo::Main.new(@key)
27
28
  response = milo.get_product_by_id("20482374")
28
29
  response.url.should == "https://api.x.com/milo/v3/products?product_ids=20482374&key=#{@key}"
30
+ response.body.should =~ /Wavy Glass Pattern Frameless Replacement Glass Block Window/
29
31
  response.status.should == 200
30
32
  end
31
33
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.alpha
5
- prerelease: 6
4
+ version: 0.0.6
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - victorhazbun87
@@ -133,13 +133,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: 2932826454436237238
136
+ hash: -878125091368183299
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
- - - ! '>'
140
+ - - ! '>='
141
141
  - !ruby/object:Gem::Version
142
- version: 1.3.1
142
+ version: '0'
143
+ segments:
144
+ - 0
145
+ hash: -878125091368183299
143
146
  requirements: []
144
147
  rubyforge_project:
145
148
  rubygems_version: 1.8.24