pasrb 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/CHANGELOG +3 -0
  2. data/Rakefile +1 -1
  3. data/lib/pas.rb +10 -1
  4. data/pasrb.gemspec +2 -2
  5. data/spec/pas_spec.rb +29 -0
  6. metadata +4 -4
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.0.5. Changes:
2
+ * #websites api method
3
+
1
4
  v0.0.4. Changes:
2
5
  * Most operations return array of hashes now.
3
6
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('pasrb', '0.0.4') do |g|
2
+ Echoe.new('pasrb', '0.0.5') do |g|
3
3
  g.description = "PokerAffiliateSupport api querying via ruby"
4
4
  g.url = "http://github.com/markiz/pasrb"
5
5
  g.author = "Markiz"
data/lib/pas.rb CHANGED
@@ -37,7 +37,14 @@ class PAS
37
37
  signature = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, api_key, payload)
38
38
  CGI::escape(Base64.encode64(signature).chomp)
39
39
  end
40
-
40
+
41
+ ## TOP LEVEL
42
+ def websites
43
+ websites = symbolize_keys [xml_to_hash(make_request("/websites.xml", "GET"))["websites"]["website"]].flatten
44
+ websites.map {|w| w[:id] = w[:id].to_i; w }
45
+ rescue
46
+ nil
47
+ end
41
48
  ## MEMBER LEVEL
42
49
 
43
50
  # List all members
@@ -77,6 +84,8 @@ class PAS
77
84
  []
78
85
  end
79
86
 
87
+ ## MEMBER TRACKERS LEVEL
88
+
80
89
  # Gets a list of all member trackers
81
90
  def get_member_trackers(member_id)
82
91
  result = xml_to_hash(make_request("/publisher_members/#{member_id}/stats.xml", "GET"))
data/pasrb.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pasrb}
5
- s.version = "0.0.4"
5
+ s.version = "0.0.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Markiz"]
9
- s.date = %q{2010-10-21}
9
+ s.date = %q{2010-10-26}
10
10
  s.description = %q{PokerAffiliateSupport api querying via ruby}
11
11
  s.email = %q{markizko@gmail.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/pas.rb"]
data/spec/pas_spec.rb CHANGED
@@ -450,5 +450,34 @@ describe PAS do
450
450
  subject.website_offers(12345).should == []
451
451
  end
452
452
  end
453
+
454
+ describe "#websites" do
455
+ before(:each) { stub_request('<?xml version="1.0" encoding="UTF-8"?>
456
+ <websites>
457
+ <website>
458
+ <id>53</id>
459
+ <name>&#1056;&#1077;&#1081;&#1082;&#1090;&#1088;&#1077;&#1082;&#1077;&#1088;</name>
460
+ <domain_name>www.raketracker.ru</domain_name>
461
+ <enabled>true</enabled>
462
+ </website>
463
+ <website>
464
+ <id>211</id>
465
+ <name>mirpokera</name>
466
+ <domain_name>rakeback.mirpokera.com</domain_name>
467
+ <enabled>true</enabled>
468
+ </website>
469
+ </websites>') }
470
+ it "should return a list of websites" do
471
+ websites = subject.websites
472
+ websites.should have_exactly(2).items
473
+ websites[1][:id].should == 211
474
+ websites[1][:name].should == "mirpokera"
475
+ end
476
+
477
+ it "should return empty nil on failure" do
478
+ stub_request("<invalid></xml>")
479
+ subject.websites.should be_nil
480
+ end
481
+ end
453
482
 
454
483
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pasrb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Markiz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-21 00:00:00 +04:00
18
+ date: 2010-10-26 00:00:00 +04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency