Sha256: d3f3e196178a398c47c7e1d93f545ed8cb71b3489b3ceace1cab4513253e28ad

Contents?: true

Size: 684 Bytes

Versions: 7

Compression:

Stored size: 684 Bytes

Contents

module Mousetrap
  class Plan < Resource
    attr_accessor \
      :code,
      :name,
      :items,
      :recurring_charge_amount


    def self.all
      response = get_resources plural_resource_name
      return [] unless response['plans']
      build_resources_from response
    end

    protected

    def self.plural_resource_name
      'plans'
    end

    def self.singular_resource_name
      'plan'
    end

    def self.attributes_from_api(attributes)
      {
        :code => attributes['code'],
        :name => attributes['name'],
        :items => attributes['items'],
        :recurring_charge_amount  => attributes['recurringChargeAmount']
      }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cameroncox-mousetrap-0.5.3.10 lib/mousetrap/plan.rb
cameroncox-mousetrap-0.5.3.9 lib/mousetrap/plan.rb
cameroncox-mousetrap-0.5.3.8 lib/mousetrap/plan.rb
cameroncox-mousetrap-0.5.3.7 lib/mousetrap/plan.rb
cameroncox-mousetrap-0.5.3.6 lib/mousetrap/plan.rb
cameroncox-mousetrap-0.5.3.5 lib/mousetrap/plan.rb
cameroncox-mousetrap-0.5.3.4 lib/mousetrap/plan.rb