-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #879 from recurly/add-pobs
Add pobs
- Loading branch information
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Recurly | ||
class PerformanceObligation < Resource | ||
|
||
define_attribute_methods %w( | ||
id | ||
name | ||
created_at | ||
updated_at | ||
) | ||
|
||
def self.collection_path | ||
"performance_obligations" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
HTTP/1.1 200 OK | ||
Content-Type: application/xml; charset=utf-8 | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<performance_obligations type="array"> | ||
<performance_obligation href="https://api.recurly.com/v2/performance_obligations/6"> | ||
<id>6</id> | ||
<name>Over Time (Daily)</name> | ||
<created_at type="datetime">2023-08-11T18:57:57Z</created_at> | ||
<updated_at type="datetime">2023-08-11T18:57:57Z</updated_at> | ||
</performance_obligation> | ||
<performance_obligation href="https://api.recurly.com/v2/performance_obligations/5"> | ||
<id>5</id> | ||
<name>Over Time (Partial Monthly)</name> | ||
<created_at type="datetime">2023-08-11T18:57:57Z</created_at> | ||
<updated_at type="datetime">2023-08-11T18:57:57Z</updated_at> | ||
</performance_obligation> | ||
<performance_obligation href="https://api.recurly.com/v2/performance_obligations/4"> | ||
<id>4</id> | ||
<name>Point in Time</name> | ||
<created_at type="datetime">2023-08-11T18:57:57Z</created_at> | ||
<updated_at type="datetime">2023-08-11T18:57:57Z</updated_at> | ||
</performance_obligation> | ||
</performance_obligations> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
HTTP/1.1 200 OK | ||
Content-Type: application/xml; charset=utf-8 | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<performance_obligation href="https://api.recurly.com/v2/performance_obligations/6"> | ||
<id>6</id> | ||
<name>Over Time (Daily)</name> | ||
<created_at type="datetime">2023-08-11T18:57:57Z</created_at> | ||
<updated_at type="datetime">2023-08-11T18:57:57Z</updated_at> | ||
</performance_obligation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'spec_helper' | ||
|
||
describe PerformanceObligation do | ||
let(:performance_obligation) { | ||
stub_api_request(:get, "performance_obligations/6", "performance_obligations/show-200") | ||
Recurly::PerformanceObligation.find '6' | ||
} | ||
|
||
let(:performance_obligations) { | ||
stub_api_request(:get, "performance_obligations", "performance_obligations/index-200") | ||
Recurly::PerformanceObligation.all | ||
} | ||
|
||
describe "#find" do | ||
it "returns a PerformanceObligation" do | ||
performance_obligation.must_be_instance_of(PerformanceObligation) | ||
end | ||
|
||
it "has correct attributes" do | ||
expect(performance_obligation.id).must_equal('6') | ||
expect(performance_obligation.name).must_equal('Over Time (Daily)') | ||
expect(performance_obligation.created_at).wont_be_nil | ||
end | ||
end | ||
|
||
describe "#index" do | ||
describe "when no params are passed" do | ||
it "returns a list of performance obligations" do | ||
expect(performance_obligations.count).must_equal(3) | ||
end | ||
end | ||
end | ||
end |