Sha256: f6dd0541eace76f2cb87f96dac38d548e3c7c321e51a29b4d216465e854c49b4

Contents?: true

Size: 929 Bytes

Versions: 4

Compression:

Stored size: 929 Bytes

Contents

require 'active_record'
require 'spigot'

Spigot.resource(:active_user) do
  id        :github_id
  full_name :name
  login     :username
  contact do
    address   :address
    telephone do
      work :work_phone
      home :home_phone
    end
    url :homepage do |value|
      "https://github.com/#{value}"
    end
  end
  options do
    primary_key :username
  end
end

Spigot.resource(:post) do
  headline :title
  content  :body
  options do
    primary_key :username
  end
end

Spigot.service(:twitter) do
  resource :active_user do
    name      :name
    username  :username
  end
end

ActiveRecord::Base.logger = Spigot.logger
require File.join(Spigot.root, 'script', 'active_record')

class ActiveUser < ActiveRecord::Base
  include Spigot::Base
  has_many :posts
end

class Post < ActiveRecord::Base
  include Spigot::Base
  belongs_to :user
end

ActiveUser.create(name: 'Matt', username: 'mwerner', token: 'abc123')

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spigot-0.3.3 script/console.rb
spigot-0.3.2 script/console.rb
spigot-0.3.1 script/console.rb
spigot-0.3.0 script/console.rb