pas 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Jose Fernandez
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ = pas
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Jose Fernandez. See LICENSE for details.
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,13 @@
1
+ require 'active_resource'
2
+ require 'active_support'
3
+ require 'openssl'
4
+ require 'base64'
5
+ require 'pas/version'
6
+ require 'pas/resource'
7
+ require 'pas/member'
8
+ require 'pas/member_tracker'
9
+
10
+ class PAS
11
+ cattr_accessor :api_access_key
12
+ cattr_accessor :api_token
13
+ end
@@ -0,0 +1,5 @@
1
+ class PAS
2
+ class Member < Resource
3
+ self.element_name = "publisher_member"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class PAS
2
+ class MemberTracker < Resource
3
+ self.element_name = "publisher_member_tracker"
4
+ end
5
+ end
@@ -0,0 +1,27 @@
1
+ class PAS
2
+ class Resource < ActiveResource::Base
3
+ self.site = "http://publisher.pas.local"
4
+
5
+ class << self
6
+ # Find a single resource from the default URL
7
+ def find_single(scope, options)
8
+ prefix_options, query_options = split_options(options[:params])
9
+
10
+ # Generate the API authentication signature and merge parameters to the query_options
11
+ path_without_query_options = element_path(scope, prefix_options)
12
+ timestamp = Time.now.to_i.to_s
13
+ signature = generate_signature("GET", path_without_query_options, timestamp)
14
+ query_options.merge!({ :api_token => PAS.api_token.to_s, :timestamp => timestamp, :signature => signature })
15
+
16
+ path = element_path(scope, prefix_options, query_options)
17
+ instantiate_record(connection.get(path, headers), prefix_options)
18
+ end
19
+
20
+ def generate_signature(request_method, request_path, timestamp)
21
+ data = PAS.api_token.to_s + request_method + request_path + timestamp
22
+ signature = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, PAS.api_access_key.to_s, data)
23
+ Base64.encode64(signature).chomp
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ class PAS
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/pas/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "pas"
6
+ s.version = PAS::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.author = "Jose Fernandez"
9
+ s.email = "jfernandez@fourcubed.com"
10
+ s.homepage = "http://github.com/jfernandez/pas"
11
+ s.summary = "Poker Affiliate Solutions API Wrapper Gem"
12
+ s.description = "This gem allows you to communicate with the PokerAffiliateSolutions.com REST API"
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ s.rubyforge_project = "pas"
16
+
17
+ s.add_dependency("activeresource", "~> 2.3.5")
18
+ s.add_dependency("activesupport", "~> 2.3.5")
19
+
20
+ s.add_development_dependency "bundler", ">= 1.0.0"
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
24
+ s.require_path = 'lib'
25
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'pas'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestPas < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pas
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Jose Fernandez
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-15 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activeresource
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 9
30
+ segments:
31
+ - 2
32
+ - 3
33
+ - 5
34
+ version: 2.3.5
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: activesupport
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 9
46
+ segments:
47
+ - 2
48
+ - 3
49
+ - 5
50
+ version: 2.3.5
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: bundler
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 23
62
+ segments:
63
+ - 1
64
+ - 0
65
+ - 0
66
+ version: 1.0.0
67
+ type: :development
68
+ version_requirements: *id003
69
+ description: This gem allows you to communicate with the PokerAffiliateSolutions.com REST API
70
+ email: jfernandez@fourcubed.com
71
+ executables: []
72
+
73
+ extensions: []
74
+
75
+ extra_rdoc_files: []
76
+
77
+ files:
78
+ - .gitignore
79
+ - Gemfile
80
+ - LICENSE
81
+ - README.rdoc
82
+ - Rakefile
83
+ - VERSION
84
+ - lib/pas.rb
85
+ - lib/pas/member.rb
86
+ - lib/pas/member_tracker.rb
87
+ - lib/pas/resource.rb
88
+ - lib/pas/version.rb
89
+ - pas.gemspec
90
+ - test/helper.rb
91
+ - test/test_pas.rb
92
+ has_rdoc: true
93
+ homepage: http://github.com/jfernandez/pas
94
+ licenses: []
95
+
96
+ post_install_message:
97
+ rdoc_options: []
98
+
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 23
116
+ segments:
117
+ - 1
118
+ - 3
119
+ - 6
120
+ version: 1.3.6
121
+ requirements: []
122
+
123
+ rubyforge_project: pas
124
+ rubygems_version: 1.3.7
125
+ signing_key:
126
+ specification_version: 3
127
+ summary: Poker Affiliate Solutions API Wrapper Gem
128
+ test_files: []
129
+