Sha256: 014aa224a725e9328b0f923b71d4f6e3eab66daefb5614beb9a9846ceac6e7b6

Contents?: true

Size: 776 Bytes

Versions: 26

Compression:

Stored size: 776 Bytes

Contents

module Octopi
  class Branch < Base
    attr_accessor :name, :sha
    include Resource
    set_resource_name "branch", "branches"

    resource_path "/repos/show/:id"
    
    # Called when we ask for a resource.
    # Arguments are passed in like [<name>, <sha>]
    # TODO: Find out why args are doubly nested
    def initialize(*args)
      args = args.flatten!
      self.name = args.first
      self.sha = args.last
    end
    
    def to_s
      name
    end
    
    def self.all(options={})
      ensure_hash(options)
      user, repo = gather_details(options)
      self.validate_args(user => :user, repo => :repo)
      BranchSet.new(find_plural([user, repo, 'branches'], :resource)) do |i|
        { :name => i.first, :hash => i.last }
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 4 rubygems

Version Path
octopi-0.4.5 lib/octopi/branch.rb
octopi-0.4.4 lib/octopi/branch.rb
octopi-0.4.3 lib/octopi/branch.rb
octopi-0.4.2 lib/octopi/branch.rb
octopi-0.4.1 lib/octopi/branch.rb
octopi-0.4.0 lib/octopi/branch.rb
octopi-0.3.0 lib/octopi/branch.rb
dcuddeback-octopi-0.2.12 lib/octopi/branch.rb
dcuddeback-octopi-0.2.11 lib/octopi/branch.rb
dcuddeback-octopi-0.2.9 lib/octopi/branch.rb
dcuddeback-octopi-0.2.8 lib/octopi/branch.rb
devver-octopi-0.2.14 lib/octopi/branch.rb
tpitale-octopi-0.3.0 lib/octopi/branch.rb
devver-octopi-0.2.13 lib/octopi/branch.rb
devver-octopi-0.2.12 lib/octopi/branch.rb
octopi-0.2.8 lib/octopi/branch.rb
devver-octopi-0.2.11 lib/octopi/branch.rb
devver-octopi-0.2.10 lib/octopi/branch.rb
devver-octopi-0.2.9 lib/octopi/branch.rb
devver-octopi-0.2.8 lib/octopi/branch.rb