Sha256: ff7b0d8384820656cecc5881cf93e20c472d10e545ee33771d8bbc0cbc9aa702

Contents?: true

Size: 1.29 KB

Versions: 12

Compression:

Stored size: 1.29 KB

Contents

module Paid
  class Plan < APIResource
    attr_reader :id
    attr_reader :object
    attr_reader :created_at
    attr_accessor :name
    attr_accessor :description
    attr_accessor :interval
    attr_accessor :interval_count
    attr_accessor :amount

    def self.all(params={}, headers={})
      method = APIMethod.new(:get, "/plans", params, headers, self)
      APIList.new(self, method.execute, method)
    end

    def self.retrieve(id, params={}, headers={})
      params = ParamsBuilder.merge(params, {
        :id => id
      })
      method = APIMethod.new(:get, "/plans/:id", params, headers, self)
      self.new(method.execute, method)
    end

    def self.create(params={}, headers={})
      method = APIMethod.new(:post, "/plans", params, headers, self)
      self.new(method.execute, method)
    end

    def refresh(params={}, headers={})
      method = APIMethod.new(:get, "/plans/:id", params, headers, self)
      self.refresh_from(method.execute, method)
    end

    APIResource.register_api_subclass(self, "plan")
    @api_attributes = {
      :id => { :readonly => true },
      :object => { :readonly => true },
      :created_at => { :readonly => true },
      :name => nil,
      :description => nil,
      :interval => nil,
      :interval_count => nil,
      :amount => nil,
    }
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
paid-1.1.2 lib/paid/plan.rb
paid-1.1.1 lib/paid/plan.rb
paid-1.1.0 lib/paid/plan.rb
paid-1.0.11 lib/paid/plan.rb
paid-1.0.10 lib/paid/plan.rb
paid-1.0.9 lib/paid/plan.rb
paid-1.0.8 lib/paid/plan.rb
paid-1.0.7 lib/paid/plan.rb
paid-1.0.6 lib/paid/plan.rb
paid-1.0.5 lib/paid/plan.rb
paid-1.0.3 lib/paid/plan.rb
paid-1.0.2 lib/paid/plan.rb