spreedly 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  = Spreedly-Gem
2
2
 
3
- * http://terralien.com/static/projects/spreedly-gem/
4
- * http://github.com/terralien/spreedly-gem
3
+ * Docs[http://terralien.com/static/projects/spreedly-gem/]
4
+ * Source[http://github.com/terralien/spreedly-gem]
5
5
 
6
6
  == DESCRIPTION:
7
7
 
data/lib/spreedly/mock.rb CHANGED
@@ -106,6 +106,10 @@ module Spreedly
106
106
  plans.values
107
107
  end
108
108
 
109
+ def self.find(id)
110
+ plans[id.to_i]
111
+ end
112
+
109
113
  def self.plans
110
114
  @plans ||= {1 => new(:id => 1, :name => 'Default mock plan')}
111
115
  end
@@ -1,3 +1,3 @@
1
1
  module Spreedly
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/spreedly.rb CHANGED
@@ -67,6 +67,10 @@ module Spreedly
67
67
  @data = data
68
68
  end
69
69
 
70
+ def id
71
+ @data["id"]
72
+ end
73
+
70
74
  def method_missing(method, *args, &block)
71
75
  if method.to_s =~ /\?$/
72
76
  send(method.to_s[0..-2])
@@ -150,5 +154,10 @@ module Spreedly
150
154
  def self.all
151
155
  Spreedly.get('/subscription_plans.xml')['subscription_plans'].collect{|data| new(data)}
152
156
  end
157
+
158
+ # Returns the subscription plan with the given id.
159
+ def self.find(id)
160
+ all.detect{|e| e.id.to_s == id.to_s}
161
+ end
153
162
  end
154
163
  end
@@ -134,6 +134,16 @@ class SpreedlyGemTest < Test::Unit::TestCase
134
134
  assert_not_nil Spreedly::SubscriptionPlan.all.first.name
135
135
  end
136
136
 
137
+ should "return the subscription plan id" do
138
+ plan = Spreedly::SubscriptionPlan.all.first
139
+ assert_not_equal plan.id, plan.object_id
140
+ end
141
+
142
+ should "be able to find an individual subscription plan" do
143
+ plan = Spreedly::SubscriptionPlan.all.first
144
+ assert_equal plan.name, Spreedly::SubscriptionPlan.find(plan.id).name
145
+ end
146
+
137
147
  only_real do
138
148
  should "throw an error if comp is wrong type" do
139
149
  sub = create_subscriber
data/test/test_site.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  name: terralien-test
2
- token: 3a8233463b5f8150d8bab0d2e7bac9272fc31763
2
+ token: 781651cf01c65b7f0c8f6565723ea60436e87a56
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreedly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Talbott
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-18 00:00:00 -07:00
12
+ date: 2009-03-19 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -111,7 +111,7 @@ files:
111
111
  - vendor/httparty/website/css/common.css
112
112
  - vendor/httparty/website/index.html
113
113
  has_rdoc: true
114
- homepage: http://terralien.com/static/projects/spreedly-gem/
114
+ homepage: Docs[http://terralien.com/static/projects/spreedly-gem/]
115
115
  post_install_message:
116
116
  rdoc_options:
117
117
  - --main