theyoweme 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ = Nibbme - Changelog
2
+
3
+
4
+ == TheyOweMe v0.1.0 released 2010/09/07
5
+
6
+ * initial release
7
+
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 [Kristijan Sedlak]
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,153 @@
1
+ = TheyOweMe - your personal note book for tracking debts and loans!
2
+
3
+ The library is a simple {ActiveResource}[http://api.rubyonrails.org/classes/ActiveResource/Base.html]-based
4
+ proxy that allows you to communicate with the {TheyOweMe web service}[http://theyowe.me].
5
+ {TheyOweMe}[http://theyowe.me] is a restful-designed system and you can easily
6
+ {create your own plugin/gem}[http://theyowe.me/wiki] based on the Wiki they provide.
7
+ If you like plugins and gems read on :).
8
+
9
+
10
+ == Installation
11
+
12
+ The recommended way is to install a gem. Simply execute
13
+
14
+ gem install theyoweme
15
+
16
+ and the latest package will be installed. If you use Rails with bundler add
17
+
18
+ gem theyoweme
19
+
20
+ to your Rails project's Gemfile file and then execute a "bundle install" command.
21
+ If you do not use bundler you will add
22
+
23
+ config.gem 'theyoweme'
24
+
25
+ to your Rails project's {RAILS_ROOT}/config/environment.rb file.
26
+
27
+
28
+ == Configuration
29
+
30
+ You've successfully installed the TheyOweMe gem and it's time to configure it.
31
+ From your rails project's root execute
32
+
33
+ theyowemerize .
34
+
35
+ This will create a configuration file theyoweme.yml inside your {RAILS_ROOT}/config
36
+ directory. Open it and set your TheyOweMe account information. The file should look
37
+ something like
38
+
39
+ default: &defaults
40
+ email: john@smith.com
41
+ password: secret
42
+
43
+ development:
44
+ <<: *defaults
45
+
46
+ test:
47
+ <<: *defaults
48
+
49
+ production:
50
+ <<: *defaults
51
+
52
+ If you do not already have a TheyOweMe account then {sign up}[http://theyowe.me/sign_up] now.
53
+
54
+ That's it! You are ready to rock&role.
55
+
56
+
57
+ == Examples
58
+
59
+ You will use this library like you use any other {ActiveResource}[http://api.rubyonrails.org/classes/ActiveResource/Base.html]
60
+ classes.
61
+
62
+
63
+ === Managing contacts
64
+
65
+ You can request data simply by calling a +find+ method.
66
+
67
+ contacts = TheyOweMe::Contact.find(:all)
68
+ contacts = TheyOweMe::Contact.find(:first)
69
+ contacts = TheyOweMe::Contact.find(:last)
70
+ contact = TheyOweMe::Contact.find(15) # Where 15 is a Contact ID number
71
+
72
+ Note that this will return only the items on the first page. You can pass the +page+ variable to
73
+ get the items on the subpage. If the request is empty you know there are no more items.
74
+
75
+ # Request the second page
76
+ contacts = TheyOweMe::Contact.find(:all, :params => { :page => 1 })
77
+
78
+ You can also filter the list through a +tags+ variable.
79
+
80
+ # Request the second page but filter only the items containing the word 'john'
81
+ contacts = TheyOweMe::Contact.find(:all, :params => { :page => 1, :tags => 'john' })
82
+
83
+ You can check if an item exists by calling the +exists?+ method.
84
+
85
+ # Check if the contact with ID=1 exists
86
+ exists = TheyOweMe::Contact.exists?(1)
87
+
88
+ You can also create, update and delete contacts.
89
+
90
+ # Create an empty contact
91
+ contact = TheyOweMe::Contact.create
92
+
93
+ # Create a contact with all information
94
+ contact = TheyOweMe::Contact.create(:full_name => 'John Smith', :gender => 'M', :email => 'john@gmail.com', :country_code => 44, :phone_number => 31321551)
95
+
96
+ # Update a contact with ID=15
97
+ contact = TheyOweMe::Contact.find(15)
98
+ contact.email = 'john@smith.com'
99
+ contact.save
100
+
101
+ # Destroy a contact with ID=12
102
+ contact = TheyOweMe::Contact.find(12)
103
+ contact.destroy
104
+
105
+
106
+ === Managing debts
107
+
108
+ You can request data simply by calling a +find+ method.
109
+
110
+ debts = TheyOweMe::Debt.find(:all)
111
+ debts = TheyOweMe::Debt.find(:first)
112
+ debts = TheyOweMe::Debt.find(:last)
113
+ debt = TheyOweMe::Debt.find(15) # Where 15 is a Debt ID number
114
+
115
+ Note that this will return only the items on the first page. You can pass the +page+ variable to
116
+ get the items on the subpage. If the request is empty you know there are no more items.
117
+
118
+ # Request the second page
119
+ debts = TheyOweMe::Debt.find(:all, :params => { :page => 1 })
120
+
121
+ You can also filter the list through a +tags+ variable.
122
+
123
+ # Request the second page but filter only the items containing the word 'john'
124
+ debts = TheyOweMe::Debt.find(:all, :params => { :page => 1, :tags => 'john' })
125
+
126
+ You can check if an item exists by calling the +exists?+ method.
127
+
128
+ # Check if the debt with ID=1 exists
129
+ exists = TheyOweMe::Debt.exists?(1)
130
+
131
+ You can also create, update and delete debts.
132
+
133
+ # Create an empty debt
134
+ debt = TheyOweMe::Debt.create
135
+
136
+ # Create a debt with all information
137
+ debt = TheyOweMe::Debt.create(:title => 'Mandy lunch at BestFood House', :description => 'She did not have money.', :contact_ids => [2], :email_notifications => true)
138
+
139
+ # Update a debt with ID=15
140
+ debt = TheyOweMe::Debt.find(15)
141
+ debt.description = nil
142
+ debt.save
143
+
144
+ # Destroy a debt with ID=12
145
+ debt = TheyOweMe::Debt.find(12)
146
+ debt.destroy
147
+
148
+
149
+ == Links
150
+
151
+ * Detailed information about the TheyOweMe web service is available on {the official TheyOweMe site}[http://theyowe.me].
152
+ * All the latest TheyOweMe news and tutorials are available on {the official TheyOweMe blog site}[http://blog.theyowe.me].
153
+ * You can find more about TheyOweMe integration on {the TheyOweMe WikiBook}[http://theyowe.me/wiki].
@@ -0,0 +1,23 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the theyoweme plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ desc 'Generate documentation for the theyoweme plugin.'
17
+ Rake::RDocTask.new(:rdoc) do |rdoc|
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = 'Theyoweme'
20
+ rdoc.options << '--line-numbers' << '--inline-source'
21
+ rdoc.rdoc_files.include('README')
22
+ rdoc.rdoc_files.include('lib/**/*.rb')
23
+ end
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file is based heavily on Capistrano's `capify` command
4
+
5
+ require 'optparse'
6
+ require 'fileutils'
7
+
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: #{File.basename($0)} [path]"
10
+
11
+ begin
12
+ opts.parse!(ARGV)
13
+ rescue OptionParser::ParseError => e
14
+ warn e.message
15
+ puts opts
16
+ exit 1
17
+ end
18
+ end
19
+
20
+ if ARGV.empty?
21
+ abort "Please specify the directory to theyowemerize, e.g. `#{File.basename($0)} .'"
22
+ elsif !File.exists?(ARGV.first)
23
+ abort "`#{ARGV.first}' does not exist."
24
+ elsif !File.directory?(ARGV.first)
25
+ abort "`#{ARGV.first}' is not a directory."
26
+ elsif ARGV.length > 1
27
+ abort "Too many arguments; please specify only the directory to theyowemerize."
28
+ end
29
+
30
+
31
+ content = <<-FILE
32
+ # Use this file to setup your TheyOweMe communication.
33
+ # Find more information at http://theyowe.me/wiki.
34
+
35
+ default: &defaults
36
+ email:
37
+ password:
38
+
39
+ development:
40
+ <<: *defaults
41
+
42
+ test:
43
+ <<: *defaults
44
+
45
+ production:
46
+ <<: *defaults
47
+
48
+ # Learn more: http://github.com/xpepermint/theyoweme
49
+ FILE
50
+
51
+ file = 'config/theyoweme.yml'
52
+ base = ARGV.shift
53
+
54
+ file = File.join(base, file)
55
+ if File.exists?(file)
56
+ warn "[skip] `#{file}' already exists"
57
+ elsif File.exists?(file.downcase)
58
+ warn "[skip] `#{file.downcase}' exists, which could conflict with `#{file}'"
59
+ elsif !File.exists?(File.dirname(file))
60
+ warn "[skip] directory `#{File.dirname(file)}' does not exist"
61
+ else
62
+ puts "[add] writing `#{file}'"
63
+ File.open(file, "w") { |f| f.write(content) }
64
+ end
65
+
66
+ puts "[done] theyowemerized!"
@@ -0,0 +1,11 @@
1
+ default: &defaults
2
+ site: 'http://theyowe.me'
3
+
4
+ development:
5
+ <<: *defaults
6
+
7
+ test:
8
+ <<: *defaults
9
+
10
+ production:
11
+ <<: *defaults
@@ -0,0 +1,25 @@
1
+ module TheyOweMe
2
+ class Tools
3
+ class << self
4
+
5
+ def config
6
+ df = File.join(File.dirname(__FILE__), '..', 'config', 'theyoweme.yml')
7
+ cf = File.join(RAILS_ROOT, 'config', 'theyoweme.yml')
8
+ config = YAML.load_file(df)[RAILS_ENV]
9
+ config = config.merge!(YAML.load_file(cf)[RAILS_ENV]) if File.exists?(cf) && YAML.load_file(cf) && YAML.load_file(cf)[RAILS_ENV]
10
+ config
11
+ end
12
+
13
+ end
14
+ end
15
+ end
16
+
17
+ THEYOWEME_CONFIG = TheyOweMe::Tools.config
18
+
19
+ %w( theyoweme/version
20
+ theyoweme/global_resource
21
+ theyoweme/contact
22
+ theyoweme/debt
23
+ ).each do |lib|
24
+ require File.join(File.dirname(__FILE__), lib)
25
+ end
@@ -0,0 +1,4 @@
1
+ module TheyOweMe
2
+ class Contact < TheyOweMe::GlobalResource
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module TheyOweMe
2
+ class Debt < TheyOweMe::GlobalResource
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ module TheyOweMe
2
+ class GlobalResource < ActiveResource::Base
3
+
4
+ self.site = THEYOWEME_CONFIG['site']
5
+ self.user = THEYOWEME_CONFIG['email']
6
+ self.password = THEYOWEME_CONFIG['password']
7
+ self.format = :xml
8
+
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module TheyOweMe
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 1
5
+ TINY = 0
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'active_support'
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class TheyowemeTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: theyoweme
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Kristijan Sedlak
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-09-07 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: TheyOweMe allows you to easily store information about things your friends or business partners have borrowed from you or things you owe them. The service is the perfect debts tracking and management solution with the ability to notify debtors through email, SMS or regular post.
22
+ email: xpepermint@gmail.com
23
+ executables:
24
+ - theyowemerize
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.rdoc
29
+ - LICENSE
30
+ - CHANGELOG.rdoc
31
+ files:
32
+ - Rakefile
33
+ - bin/theyowemerize
34
+ - lib/theyoweme/contact.rb
35
+ - lib/theyoweme/debt.rb
36
+ - lib/theyoweme/global_resource.rb
37
+ - lib/theyoweme/version.rb
38
+ - lib/theyoweme.rb
39
+ - test/test_helper.rb
40
+ - test/theyoweme_test.rb
41
+ - config/theyoweme.yml
42
+ - README.rdoc
43
+ - LICENSE
44
+ - CHANGELOG.rdoc
45
+ has_rdoc: true
46
+ homepage: http://github.com/xpepermint/theyoweme
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --main
52
+ - README.rdoc
53
+ - --charset=UTF-8
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.3.7
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: TheyOweMe - your personal note book for tracking debts and loans.
79
+ test_files: []
80
+