hukd 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -22,10 +22,13 @@ You can start of by creating an instance of the client, which just needs an Api
22
22
  require 'hukd'
23
23
  hukd = Hukd.new("YOUR_API_KEY_HERE")
24
24
 
25
- You can then make an API request to receive an array of Deal objects.
25
+ You can then make an API request to receive a hash containing the following keys:
26
26
 
27
27
  deals = hukd.hottest('deals')
28
28
 
29
+ :deals - An array containing Deal objects
30
+ :total_results - The total number of results that can be retrieved using the current filter options
31
+
29
32
  The following API calls are available
30
33
 
31
34
  hottest(forum='', category='', limit=20, options={})
@@ -52,6 +55,7 @@ Each deal object has the following attributes available:
52
55
  hot_time
53
56
  poster_name
54
57
  temperature
58
+ temperature_rounded
55
59
  price
56
60
  timestamp
57
61
  expired
@@ -69,11 +73,13 @@ Combining everything together will give you something like this:
69
73
  require 'hukd'
70
74
  hukd = Hukd.new("YOUR_API_KEY_HERE")
71
75
  deals = hukd.hottest('deals')
72
- deals.each |deal| do
76
+ deals[:deals].each |deal| do
73
77
  puts(deal.title)
74
78
  end
79
+ puts(deals[:total_results])
75
80
 
76
81
  This will fetch the hottest deals (default at 20) and print the title to the console.
82
+ The total number of available results will be printed underneath
77
83
 
78
84
  Support
79
85
  --------
@@ -109,7 +109,7 @@ module Hukd
109
109
  raise Exception, resp['error']
110
110
  end
111
111
  # Returned parsed deals
112
- return parse_deals(resp)
112
+ return {:deals => parse_deals(resp), :total_results => resp['total_results'] }
113
113
  end
114
114
 
115
115
  end
@@ -1,3 +1,3 @@
1
1
  module Hukd
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -4,7 +4,7 @@ require "hukd"
4
4
  describe Hukd::Deal do
5
5
 
6
6
  before(:all) do
7
- @deal = Hukd.new("API_KEY_HERE").hottest('deals','',1)[0]
7
+ @deal = Hukd.new("API_KEY_HERE").hottest('deals','',1)[:deals][0]
8
8
  end
9
9
 
10
10
  it "should have a rounded temperature" do
@@ -8,45 +8,45 @@ describe Hukd::Base do
8
8
  end
9
9
 
10
10
  it "should get hottest deals" do
11
- Hukd.new("API_KEY_HERE").hottest('deals').count.should equal(20)
11
+ Hukd.new("API_KEY_HERE").hottest('deals')[:deals].count.should equal(20)
12
12
  end
13
13
 
14
14
  it "should get a custom number of deals" do
15
- Hukd.new("API_KEY_HERE").hottest('deals','',10).count.should equal(10)
15
+ Hukd.new("API_KEY_HERE").hottest('deals','',10)[:deals].count.should equal(10)
16
16
  end
17
17
 
18
18
  it "shouldn't get more than 500 deals" do
19
- Hukd.new("API_KEY_HERE").hottest('deals','',10000).count.should equal(500)
19
+ Hukd.new("API_KEY_HERE").hottest('deals','',10000)[:deals].count.should equal(500)
20
20
  end
21
21
 
22
22
  it "should be able to specify a forum" do
23
- Hukd.new("API_KEY_HERE").hottest('vouchers','',1)[0].forum_url_name.should == "vouchers"
23
+ Hukd.new("API_KEY_HERE").hottest('vouchers','',1)[:deals][0].forum_url_name.should == "vouchers"
24
24
  end
25
25
 
26
26
  it "should be able to specify a category" do
27
- Hukd.new("API_KEY_HERE").hottest('','fashion',0)[0].category_url_name.should == "fashion"
27
+ Hukd.new("API_KEY_HERE").hottest('','fashion',0)[:deals][0].category_url_name.should == "fashion"
28
28
  end
29
29
 
30
30
  it "should be able to specify a forum and category" do
31
- deal = Hukd.new("API_KEY_HERE").hottest('freebies','mobiles',1)[0]
31
+ deal = Hukd.new("API_KEY_HERE").hottest('freebies','mobiles',1)[:deals][0]
32
32
  deal.forum_url_name.should == "freebies"
33
33
  deal.category_url_name.should == "mobiles"
34
34
  end
35
35
 
36
36
  it "should search by username" do
37
- Hukd.new("API_KEY_HERE").user('wishihadadonkey','','',1)[0].poster_name.should == "wishihadadonkey"
37
+ Hukd.new("API_KEY_HERE").user('wishihadadonkey','','',1)[:deals][0].poster_name.should == "wishihadadonkey"
38
38
  end
39
39
 
40
40
  it "should search by tag" do
41
- Hukd.new("API_KEY_HERE").tag('xbox','deals','',1)[0].tags.should include('xbox')
41
+ Hukd.new("API_KEY_HERE").tag('xbox','deals','',1)[:deals][0].tags.should include('xbox')
42
42
  end
43
43
 
44
44
  it "should search by merchant" do
45
- Hukd.new("API_KEY_HERE").merchant('itunes.apple.com','','',1)[0].merchant_url_name.should == "itunes.apple.com"
45
+ Hukd.new("API_KEY_HERE").merchant('itunes.apple.com','','',1)[:deals][0].merchant_url_name.should == "itunes.apple.com"
46
46
  end
47
47
 
48
48
  it "should search by keyword" do
49
- Hukd.new("API_KEY_HERE").search('xbox','deals','',false,1,1)[0].title.downcase.should include("xbox")
49
+ Hukd.new("API_KEY_HERE").search('xbox','deals','',false,1,1)[:deals][0].title.downcase.should include("xbox")
50
50
  end
51
51
 
52
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hukd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2153284900 !ruby/object:Gem::Requirement
16
+ requirement: &2165281240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.6'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153284900
24
+ version_requirements: *2165281240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: httparty
27
- requirement: &2153283600 !ruby/object:Gem::Requirement
27
+ requirement: &2165280800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153283600
35
+ version_requirements: *2165280800
36
36
  description: API Wrapper for HotUKDeals (HUKD)
37
37
  email:
38
38
  - messages@cubewebsites.com