Project

typhoid

0.01
No commit activity in last 3 years
No release in over 3 years
A lightweight ORM-like wrapper around Typhoeus
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
~> 0.4
 Project Readme

Typhoid

TravisCI

A lightweight ORM-like wrapper around Typhoeus

Installation

Add this line to your application's Gemfile:

gem 'typhoid'

And then execute:

$ bundle

Or install it yourself as:

$ gem install typhoid

Usage

Class Setup

require 'typhoid'

class Game < Typhoid::Resource
  field :id
  field :team_1_name
  field :team_2_name
  field :start_time

  self.site = 'http://localhost:3000/'  # The base-url for where we plan to retrieve data
  self.path = 'games/'                  # Specific path to get the data for this Class

  def self.get_game
    build_request("http://localhost:3000/games/1")
  end
end

A field creates a accessor methods that can be mass-assigned:

g = Game.new id: 1, team_1_name: "Team 1", start_time: Time.now

g.id                # => 1
g.team_1_name       # => "Team 1"
g.team_2_name       # => nil
g.start_time        # => #<Time: ...>

g.team_2_name = "Team 2"
g.team_2_name       # => "Team 2"

These fields will be set on request and will be

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write some tests (Yes now.. [vim spec/...])
  4. Commit your changes (git commit -am 'Added some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request