Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved the examples into accessible locations.

  • Loading branch information...
commit c5256ebb70d66165421bb77b7104a22df4c1cee4 1 parent 5fc4044
@sneakin authored
View
2  README.md
@@ -50,7 +50,7 @@ Examples
end
-More for [Bitter](http://bitter.rubyforge.org/) and [Syncd](http://www.syncd.com/) can be found in [`./examples`](http://github.com/sneakin/nom-nom/tree/master/examples/).
+More for [Bitter](http://bitter.rubyforge.org/) and [Syncd](http://www.syncd.com/) can be found in [`./lib/nom_nom/services`](http://github.com/sneakin/nom-nom/tree/master/lib/nom_nom/services/).
License
View
10 examples/bitter.rb → lib/nom_nom/services/bitter.rb
@@ -4,23 +4,19 @@ class Bitter
include NomNom::Service
def initialize(url, user, pass)
- super(url, user, pass, Bitter)
+ super(url, user, pass)
end
resources :bits
resources :users
- class Bit
+ class Bit < Struct.new(:id, :body, :user_id, :created_on, :updated_on)
include NomNom::Resource
-
- attr_accessor :id, :body, :user_id, :created_on, :updated_on
belongs_to :user
end
- class User
+ class User < Struct.new(:id, :login)
include NomNom::Resource
-
- attr_accessor :id, :login
has_many :bits
end
end
View
45 examples/syncd.rb → lib/nom_nom/services/syncd.rb
@@ -1,22 +1,20 @@
require 'nom_nom'
-module Syncd
- class Account
- include NomNom::Service
+class Syncd
+ include NomNom::Service
- def initialize(subdomain, user, pass)
- super("https://#{subdomain}.syncd.com", user, pass, Syncd)
- end
+ def initialize(subdomain, user, pass)
+ super("https://#{subdomain}.syncd.com", user, pass)
+ end
- resources :activities
- resources :jobs
- resources :job_types
- resources :time_entries
- resources :users
+ resources :activities
+ resources :jobs
+ resources :job_types
+ resources :time_entries
+ resources :users
- def time_entry_summary(query = Hash.new)
- get("/time_entries/summary.xml", :query => query)['time_summary']
- end
+ def time_entry_summary(query = Hash.new)
+ get("/time_entries/summary.xml", :query => query)['time_summary']
end
class Activity
@@ -37,32 +35,31 @@ class TimeEntry
belongs_to :activity
end
+ module Ancestors
+ def ancestors
+ return [ self, *parent.ancestors ] if parent_id
+ return [ self ]
+ end
+ end
+
class Job
include NomNom::Resource
+ include Ancestors
attr_accessor :id, :job_type_id, :parent_id, :name, :code, :description, :url, :active, :effectively_active, :allow_time_entries, :allow_expense_entries, :assigned
belongs_to :job_type
belongs_to :parent, :class_name => self.name.demodulize, :key => :parent_id
-
- def ancestors
- return [ self, *parent.ancestors ] if parent_id
- return [ self ]
- end
end
class JobType
include NomNom::Resource
+ include Ancestors
attr_accessor :id, :parent_id, :name, :name_plural, :allow_time_entries, :allow_expense_entries, :show_codes, :show_links, :show_descriptions, :levels
belongs_to :parent, :class_name => self.name.demodulize
has_many :children, :class_name => self.name.demodulize, :key => :parent_id
-
- def ancestors
- return [ self, *parent.ancestors ] if parent_id
- return [ self ]
- end
end
class User
View
68 nom_nom.gemspec
@@ -1,68 +0,0 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = %q{nom_nom}
- s.version = "0.0.4"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Nolan Eakins"]
- s.date = %q{2010-09-26}
- s.description = %q{I consume web service. Nom nom nom.}
- s.email = %q{sneakin+nomnom@semanticgap.com}
- s.extra_rdoc_files = [
- "LICENSE",
- "README.md"
- ]
- s.files = [
- ".gitignore",
- "LICENSE",
- "README.md",
- "Rakefile",
- "VERSION",
- "examples/bitter.rb",
- "examples/syncd.rb",
- "lib/nom_nom.rb",
- "lib/nom_nom/resource.rb",
- "lib/nom_nom/service.rb",
- "nom_nom.gemspec",
- "spec/nom_nom_spec.rb",
- "spec/spec_helper.rb"
- ]
- s.homepage = %q{http://github.com/sneakin/nom-nom}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
- s.summary = %q{COOKIE!!}
- s.test_files = [
- "spec/nom_nom_spec.rb",
- "spec/spec_helper.rb",
- "examples/bitter.rb",
- "examples/syncd.rb"
- ]
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
-
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_development_dependency(%q<rspec>, [">= 0"])
- s.add_runtime_dependency(%q<nokogiri>, ["= 1.4.3.1"])
- s.add_runtime_dependency(%q<httparty>, ["= 0.6.1"])
- s.add_runtime_dependency(%q<activesupport>, ["= 3.0.0"])
- else
- s.add_dependency(%q<rspec>, [">= 0"])
- s.add_dependency(%q<nokogiri>, ["= 1.4.3.1"])
- s.add_dependency(%q<httparty>, ["= 0.6.1"])
- s.add_dependency(%q<activesupport>, ["= 3.0.0"])
- end
- else
- s.add_dependency(%q<rspec>, [">= 0"])
- s.add_dependency(%q<nokogiri>, ["= 1.4.3.1"])
- s.add_dependency(%q<httparty>, ["= 0.6.1"])
- s.add_dependency(%q<activesupport>, ["= 3.0.0"])
- end
-end
-
Please sign in to comment.
Something went wrong with that request. Please try again.