rspreedly 0.1.11 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +70 -38
- data/lib/rspreedly.rb +2 -0
- data/lib/rspreedly/base.rb +2 -2
- data/lib/rspreedly/config.rb +23 -22
- data/lib/rspreedly/credit.rb +5 -0
- data/lib/rspreedly/payment_method.rb +5 -0
- data/lib/rspreedly/subscriber.rb +12 -2
- data/lib/rspreedly/subscription_plan.rb +9 -2
- data/lib/rspreedly/transaction.rb +39 -0
- data/rspreedly.gemspec +16 -81
- data/spec/base_spec.rb +23 -22
- data/spec/config_spec.rb +50 -50
- data/spec/fixtures/credit_not_valid.xml +4 -0
- data/spec/fixtures/credit_success.xml +0 -0
- data/spec/fixtures/no_transactions.xml +2 -0
- data/spec/fixtures/subscription_plan_list.xml +2 -2
- data/spec/fixtures/transactions.xml +63 -0
- data/spec/invoice_spec.rb +103 -68
- data/spec/spec_helper.rb +10 -27
- data/spec/subscriber_spec.rb +359 -198
- data/spec/subscription_plan_spec.rb +30 -5
- data/spec/transaction_spec.rb +28 -0
- metadata +78 -61
- data/.document +0 -5
- data/.gitignore +0 -5
- data/VERSION +0 -1
@@ -7,30 +7,55 @@ describe RSpreedly::SubscriptionPlan do
|
|
7
7
|
it "should pass to RSpreedly::SubscriptionPlan.all" do
|
8
8
|
RSpreedly::SubscriptionPlan.should_receive(:all)
|
9
9
|
RSpreedly::SubscriptionPlan.find(:all)
|
10
|
-
end
|
10
|
+
end
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should return nil with an id for a plan which doesn't exist" do
|
14
|
-
|
14
|
+
stub_request(:get, spreedly_url("/subscription_plans.xml")).
|
15
|
+
to_return(:body => fixture("subscription_plan_list.xml"), :status => 200)
|
16
|
+
|
15
17
|
RSpreedly::SubscriptionPlan.find(99).should be_nil
|
16
18
|
end
|
17
19
|
|
18
20
|
it "should return a SubscriptionPlan with an id for an existing plan" do
|
19
|
-
|
21
|
+
stub_request(:get, spreedly_url("/subscription_plans.xml")).
|
22
|
+
to_return(:body => fixture("subscription_plan_list.xml"), :status => 200)
|
23
|
+
|
20
24
|
RSpreedly::SubscriptionPlan.find(42).should be_a(RSpreedly::SubscriptionPlan)
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
24
28
|
describe ".all" do
|
25
29
|
it "should return an empty array if there are no plans" do
|
26
|
-
|
30
|
+
stub_request(:get, spreedly_url("/subscription_plans.xml")).
|
31
|
+
to_return(:body => fixture("no_plans.xml"), :status => 200)
|
32
|
+
|
27
33
|
RSpreedly::SubscriptionPlan.all.should == []
|
28
34
|
end
|
29
35
|
|
30
36
|
it "should return an array of SubscriptionPlans if there are any to find" do
|
31
|
-
|
37
|
+
stub_request(:get, spreedly_url("/subscription_plans.xml")).
|
38
|
+
to_return(:body => fixture("subscription_plan_list.xml"), :status => 200)
|
39
|
+
|
32
40
|
RSpreedly::SubscriptionPlan.all.size.should == 4 # there are 4 in the fixture
|
33
41
|
RSpreedly::SubscriptionPlan.all.select{|x| x.is_a?(RSpreedly::SubscriptionPlan )}.size.should == 4
|
34
42
|
end
|
35
43
|
end
|
44
|
+
|
45
|
+
describe ".active" do
|
46
|
+
it "should return an empty array if there are no plans at all" do
|
47
|
+
stub_request(:get, spreedly_url("/subscription_plans.xml")).
|
48
|
+
to_return(:body => fixture("no_plans.xml"), :status => 200)
|
49
|
+
RSpreedly::SubscriptionPlan.active.should == []
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return an array of active SubscriptionPlans if there are any to find" do
|
53
|
+
stub_request(:get, spreedly_url("/subscription_plans.xml")).
|
54
|
+
to_return(:body => fixture("subscription_plan_list.xml"), :status => 200)
|
55
|
+
|
56
|
+
RSpreedly::SubscriptionPlan.active.size.should == 2
|
57
|
+
RSpreedly::SubscriptionPlan.active.select{|x| x.is_a?(RSpreedly::SubscriptionPlan )}.size.should == 2
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
36
61
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
describe RSpreedly::Transaction do
|
3
|
+
|
4
|
+
describe ".all" do
|
5
|
+
it "should return an empty array if there are no transactions" do
|
6
|
+
stub_request(:get, spreedly_url("/transactions.xml")).
|
7
|
+
to_return(:body => fixture("no_transactions.xml"), :status => 200)
|
8
|
+
|
9
|
+
RSpreedly::Transaction.all.should == []
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return an array of transactions if there are any to find" do
|
13
|
+
stub_request(:get, spreedly_url("/transactions.xml")).
|
14
|
+
to_return(:body => fixture("transactions.xml"), :status => 200)
|
15
|
+
|
16
|
+
RSpreedly::Transaction.all.size.should == 3 # there are 3 in the fixture
|
17
|
+
RSpreedly::Transaction.all.select{|x| x.is_a?(RSpreedly::Transaction )}.size.should == 3
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should allow specifying the ID of the transaction to start (since_id)" do
|
21
|
+
stub_request(:get, spreedly_url("/transactions.xml?since_id=123")).
|
22
|
+
to_return(:body => fixture("transactions.xml"), :status => 200)
|
23
|
+
|
24
|
+
RSpreedly::Transaction.all(:since => 123)
|
25
|
+
WebMock.should have_requested(:get, spreedly_url("/transactions.xml?since_id=123"))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,55 +1,60 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspreedly
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.14
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Richard Livsey
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2010-01-20 00:00:00 +01:00
|
12
|
+
date: 2011-07-21 00:00:00.000000000 +01:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- !ruby/object:Gem::Version
|
17
|
+
requirement: &2165032460 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
23
22
|
version: 0.5.0
|
24
|
-
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2165032460
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &2165031860 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2165031860
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: webmock
|
39
|
+
requirement: &2165031220 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2165031220
|
25
48
|
description:
|
26
49
|
email: richard@livsey.org
|
27
50
|
executables: []
|
28
|
-
|
29
51
|
extensions: []
|
30
|
-
|
31
|
-
extra_rdoc_files:
|
32
|
-
- LICENSE
|
52
|
+
extra_rdoc_files:
|
33
53
|
- README.rdoc
|
34
|
-
files:
|
35
|
-
- .document
|
36
|
-
- .gitignore
|
54
|
+
files:
|
37
55
|
- LICENSE
|
38
|
-
- README.rdoc
|
39
56
|
- Rakefile
|
40
|
-
-
|
41
|
-
- lib/rspreedly.rb
|
42
|
-
- lib/rspreedly/base.rb
|
43
|
-
- lib/rspreedly/complimentary_subscription.rb
|
44
|
-
- lib/rspreedly/complimentary_time_extension.rb
|
45
|
-
- lib/rspreedly/config.rb
|
46
|
-
- lib/rspreedly/error.rb
|
47
|
-
- lib/rspreedly/invoice.rb
|
48
|
-
- lib/rspreedly/lifetime_complimentary_subscription.rb
|
49
|
-
- lib/rspreedly/line_item.rb
|
50
|
-
- lib/rspreedly/payment_method.rb
|
51
|
-
- lib/rspreedly/subscriber.rb
|
52
|
-
- lib/rspreedly/subscription_plan.rb
|
57
|
+
- README.rdoc
|
53
58
|
- rspreedly.gemspec
|
54
59
|
- spec/base_spec.rb
|
55
60
|
- spec/config_spec.rb
|
@@ -58,6 +63,8 @@ files:
|
|
58
63
|
- spec/fixtures/complimentary_not_valid.xml
|
59
64
|
- spec/fixtures/complimentary_success.xml
|
60
65
|
- spec/fixtures/create_subscriber.xml
|
66
|
+
- spec/fixtures/credit_not_valid.xml
|
67
|
+
- spec/fixtures/credit_success.xml
|
61
68
|
- spec/fixtures/error.xml
|
62
69
|
- spec/fixtures/error_string.txt
|
63
70
|
- spec/fixtures/errors.xml
|
@@ -74,6 +81,7 @@ files:
|
|
74
81
|
- spec/fixtures/lifetime_subscription_success.xml
|
75
82
|
- spec/fixtures/no_plans.xml
|
76
83
|
- spec/fixtures/no_subscribers.xml
|
84
|
+
- spec/fixtures/no_transactions.xml
|
77
85
|
- spec/fixtures/payment_already_paid.xml
|
78
86
|
- spec/fixtures/payment_invalid.xml
|
79
87
|
- spec/fixtures/payment_not_found.xml
|
@@ -84,42 +92,51 @@ files:
|
|
84
92
|
- spec/fixtures/subscriber_not_found.xml
|
85
93
|
- spec/fixtures/subscribers.xml
|
86
94
|
- spec/fixtures/subscription_plan_list.xml
|
95
|
+
- spec/fixtures/transactions.xml
|
87
96
|
- spec/invoice_spec.rb
|
88
97
|
- spec/spec_helper.rb
|
89
98
|
- spec/subscriber_spec.rb
|
90
99
|
- spec/subscription_plan_spec.rb
|
100
|
+
- spec/transaction_spec.rb
|
101
|
+
- lib/rspreedly/base.rb
|
102
|
+
- lib/rspreedly/complimentary_subscription.rb
|
103
|
+
- lib/rspreedly/complimentary_time_extension.rb
|
104
|
+
- lib/rspreedly/config.rb
|
105
|
+
- lib/rspreedly/credit.rb
|
106
|
+
- lib/rspreedly/error.rb
|
107
|
+
- lib/rspreedly/invoice.rb
|
108
|
+
- lib/rspreedly/lifetime_complimentary_subscription.rb
|
109
|
+
- lib/rspreedly/line_item.rb
|
110
|
+
- lib/rspreedly/payment_method.rb
|
111
|
+
- lib/rspreedly/subscriber.rb
|
112
|
+
- lib/rspreedly/subscription_plan.rb
|
113
|
+
- lib/rspreedly/transaction.rb
|
114
|
+
- lib/rspreedly.rb
|
91
115
|
has_rdoc: true
|
92
116
|
homepage: http://github.com/rlivsey/rspreedly
|
93
117
|
licenses: []
|
94
|
-
|
95
118
|
post_install_message:
|
96
|
-
rdoc_options:
|
97
|
-
- --
|
98
|
-
|
119
|
+
rdoc_options:
|
120
|
+
- --main
|
121
|
+
- README.rdoc
|
122
|
+
require_paths:
|
99
123
|
- lib
|
100
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
112
136
|
requirements: []
|
113
|
-
|
114
137
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.6.2
|
116
139
|
signing_key:
|
117
140
|
specification_version: 3
|
118
141
|
summary: Ruby library for the Spreedly API
|
119
|
-
test_files:
|
120
|
-
- spec/base_spec.rb
|
121
|
-
- spec/config_spec.rb
|
122
|
-
- spec/invoice_spec.rb
|
123
|
-
- spec/spec_helper.rb
|
124
|
-
- spec/subscriber_spec.rb
|
125
|
-
- spec/subscription_plan_spec.rb
|
142
|
+
test_files: []
|
data/.document
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.11
|