referly 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,36 @@
1
+ Referly
2
+ ======
3
+
4
+ Referly is a Ruby wrapper for the Referly API.
5
+
6
+ Usage
7
+ --------
8
+ You must first create a client object.
9
+
10
+ ``` ruby
11
+ client = Referly.new(key, secret)
12
+ ```
13
+
14
+ Accounts
15
+ --------
16
+ ``` ruby
17
+ client.accounts.create(email: 'foo@bar.com')
18
+ ```
19
+
20
+ Links
21
+ --------
22
+ ``` ruby
23
+ client.links.create(url: 'http://refer.ly')
24
+ client.links.all
25
+ ```
26
+
27
+ Rewards
28
+ --------
29
+ ``` ruby
30
+ client.rewards.create(visit_id: '12345', amount: 1.00, earned_on: '2012-07-23', payable_on: '2012-07-24')
31
+ client.rewards.all
32
+ ```
33
+
34
+ Contributing
35
+ --------
36
+ Pull requests are welcomed.
@@ -0,0 +1,11 @@
1
+ module Referly
2
+ class AccountProxy
3
+ def initialize(client)
4
+ @client = client
5
+ end
6
+
7
+ def create(options={})
8
+ @client.post('/accounts', options)['account_id']
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ require 'httparty'
2
+
3
+ module Referly
4
+ class Client
5
+ include HTTParty
6
+ base_uri 'https://refer.ly/api/120701'
7
+
8
+ def initialize(key, secret)
9
+ self.class.basic_auth key, secret
10
+ end
11
+
12
+ def post(path, options)
13
+ self.class.post(path, body: options)
14
+ end
15
+
16
+ def get(path, options)
17
+ self.class.get(path, query: options)
18
+ end
19
+
20
+ def accounts
21
+ Referly::AccountProxy.new(self)
22
+ end
23
+
24
+ def links
25
+ Referly::LinkProxy.new(self)
26
+ end
27
+
28
+ def rewards
29
+ Referly::RewardProxy.new(self)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,15 @@
1
+ module Referly
2
+ class LinkProxy
3
+ def initialize(client)
4
+ @client = client
5
+ end
6
+
7
+ def all(options={})
8
+ @client.get('/links', options).parsed_response
9
+ end
10
+
11
+ def create(params={})
12
+ @client.post('/links', options).parsed_response
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Referly
2
+ class RewardProxy
3
+ def initialize(client)
4
+ @client = client
5
+ end
6
+
7
+ def all(options={})
8
+ @client.get('/rewards', options).parsed_response
9
+ end
10
+
11
+ def create(options={})
12
+ @client.post('/rewards', options).parsed_response
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Referly
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/referly.rb CHANGED
@@ -1,5 +1,13 @@
1
- require "referly/version"
1
+ require 'referly/version'
2
+ require 'referly/client'
3
+ require 'referly/account_proxy'
4
+ require 'referly/link_proxy'
5
+ require 'referly/reward_proxy'
2
6
 
3
7
  module Referly
4
- # Your code goes here...
5
- end
8
+ class << self
9
+ def new(key, secret)
10
+ Referly::Client.new(key, secret)
11
+ end
12
+ end
13
+ end
data/referly.gemspec CHANGED
@@ -1,24 +1,36 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "referly/version"
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'referly/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "referly"
6
+ s.name = 'referly'
7
7
  s.version = Referly::VERSION
8
- s.authors = ["maxstoller"]
9
- s.email = ["maxstoller@gmail.com"]
10
- s.homepage = ""
8
+ s.authors = ['maxstoller']
9
+ s.email = ['maxstoller@gmail.com']
10
+ s.homepage = ''
11
11
  s.summary = %q{Referly API wrapper}
12
12
  s.description = %q{A Ruby wrapper for the Referly API.}
13
13
 
14
- s.rubyforge_project = "referly"
14
+ s.rubyforge_project = 'referly'
15
15
 
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
16
+ s.files = [
17
+ 'README.markdown',
18
+ 'Gemfile',
19
+ 'referly.gemspec',
20
+ 'Rakefile',
21
+ 'lib/referly.rb',
22
+ 'lib/referly/client.rb',
23
+ 'lib/referly/version.rb',
24
+ 'lib/referly/account_proxy.rb',
25
+ 'lib/referly/link_proxy.rb',
26
+ 'lib/referly/reward_proxy.rb'
27
+ ]
28
+
29
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split('\n')
30
+ s.executables = `git ls-files -- bin/*`.split('\n').map{ |f| File.basename(f) }
31
+ s.require_paths = ['lib']
20
32
 
21
33
  # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
34
+ # s.add_development_dependency 'rspec'
35
+ s.add_runtime_dependency 'httparty'
24
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: referly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,18 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-07-24 00:00:00.000000000Z
13
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: &70215830749780 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70215830749780
14
25
  description: A Ruby wrapper for the Referly API.
15
26
  email:
16
27
  - maxstoller@gmail.com
@@ -18,12 +29,16 @@ executables: []
18
29
  extensions: []
19
30
  extra_rdoc_files: []
20
31
  files:
21
- - .gitignore
32
+ - README.markdown
22
33
  - Gemfile
34
+ - referly.gemspec
23
35
  - Rakefile
24
36
  - lib/referly.rb
37
+ - lib/referly/client.rb
25
38
  - lib/referly/version.rb
26
- - referly.gemspec
39
+ - lib/referly/account_proxy.rb
40
+ - lib/referly/link_proxy.rb
41
+ - lib/referly/reward_proxy.rb
27
42
  homepage: ''
28
43
  licenses: []
29
44
  post_install_message:
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*