Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Testing your changes against Ruby 1.9.3 and ~> 2.3 should be enough to ensure co

## RUNNING:

Consult the Linode API guide here: [https://www.linode.com/api/](https://www.linode.com/api/)
Consult the Linode API guide here: [https://www.linode.com/apiv3/](https://www.linode.com/apiv3/)
You will need to get an API key (check your account profile).

Here is an annoyingly exhaustive IRB session where I play around with the API:
Expand Down Expand Up @@ -189,6 +189,8 @@ RuntimeError: Errors completing request [linode.ip.list] @ [https://api.linode.c
- Error #6 - LINODEID is required but was not passed in. (Please consult http://www.linode.com/api/linode/linode.ip.list)
irb> l.linode.ip.list(:LinodeId => 12446)
=> [#<OpenStruct rdns_name="byggvir.websages.com", ipaddressid=12286, linodeid=12446, ispublic=1, ipaddress="209.123.234.161">, #<OpenStruct rdns_name="li101-51.members.linode.com", ipaddressid=23981, linodeid=12446, ispublic=1, ipaddress="97.107.140.51">]
irb> l.linode.create(:datacenterid => 2, :planid =>1)
=> #<Linode::OpenStruct linodeid=14413539>
irb> ^D@ Wed Aug 05 01:50:52 rick@Yer-Moms-Computer
```

Expand Down
2 changes: 1 addition & 1 deletion lib/linode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def self.class_to_path(class_name)

def documentation_path(action)
hits = action.match(/^(.*)\.[^.]+$/)
"https://www.linode.com/api/" + @@documentation_category[hits[1]] + '/' + action
"https://www.linode.com/apiv3/" + @@documentation_category[hits[1]] + '/' + action
end

def initialize(args)
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/account/account.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/account/account.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/account/account.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/account/account.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/avail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/utility/avail.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/utility/avail.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/utility/avail.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/utility/avail.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/domain/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/dns/domain.resource.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/dns/domain.resource.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/dns/domain.resource.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/dns/domain.resource.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/domain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/dns/domain.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/dns/domain.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/dns/domain.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/dns/domain.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/image/image.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/image/image.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/image/image.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/image/image.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/linode/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/linode/linode.config.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/linode/linode.config.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/linode/linode.config.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/linode/linode.config.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/linode/disk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/linode/linode.disk.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/linode/linode.disk.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/linode/linode.disk.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/linode/linode.disk.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/linode/ip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/linode/linode.ip.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/linode/linode.ip.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/linode/linode.ip.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/linode/linode.ip.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/linode/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/linode/linode.job.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/linode/linode.job.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/linode/linode.job.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/linode/linode.job.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/linode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/linode/linode.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/linode/linode.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/linode/linode.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/linode/linode.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/nodebalancer/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/nodebalancer/nodebalancer.config.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/nodebalancer/nodebalancer.config.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/nodebalancer/nodebalancer.config.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/nodebalancer/nodebalancer.config.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/nodebalancer/node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/nodebalancer/nodebalancer.node.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/nodebalancer/nodebalancer.node.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/nodebalancer/nodebalancer.node.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/nodebalancer/nodebalancer.node.#{action}"
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/linode/nodebalancer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/nodebalancer/nodebalancer.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/nodebalancer/nodebalancer.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/nodebalancer/nodebalancer.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/nodebalancer/nodebalancer.#{action}"
end
end
end
Expand All @@ -62,7 +62,7 @@
it 'should allow no arguments' do
lambda { @linode.config }.should_not raise_error
end

it 'should require no arguments' do
lambda { @linode.config(:foo) }.should raise_error(ArgumentError)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/stackscript_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/stackscript/stackscript.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/stackscript/stackscript.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/stackscript/stackscript.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/stackscript/stackscript.#{action}"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/linode/test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
@linode.send(action.to_sym).should == { :bar => :baz }
end

it "should consider the documentation to live at https://www.linode.com/api/linode/linode.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/utility/test.#{action}"
it "should consider the documentation to live at https://www.linode.com/apiv3/linode/linode.#{action}" do
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/apiv3/utility/test.#{action}"
end
end
end
Expand Down
18 changes: 9 additions & 9 deletions spec/linode/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@
@api_key = 'foo'
@linode = Linode::User.new(:api_key => @api_key)
end

it 'should be a Linode instance' do
@linode.class.should < Linode
end

it 'should be able to return the API key for the connection' do
@linode.should respond_to(:getapikey)
end

describe 'when returning the API key for the connection' do
it 'should work without arguments' do
lambda { @linode.getapikey }.should_not raise_error
end

it 'should not allow arguments' do
lambda { @linode.getapikey(:foo) }.should raise_error(ArgumentError)
lambda { @linode.getapikey(:foo) }.should raise_error(ArgumentError)
end

it 'should return the api_key via the Linode handle' do
@linode.stubs(:api_key).returns('foo')
@linode.getapikey.should == 'foo'
end
it "should consider the documentation to live at https://www.linode.com/api/utility/user.getapikey" do
@linode.documentation_path(Linode.action_path(@linode.class.name, 'getapikey')).should == "https://www.linode.com/api/utility/user.getapikey"

it "should consider the documentation to live at https://www.linode.com/apiv3/utility/user.getapikey" do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linode.documentation_path(Linode.action_path(@linode.class.name, 'getapikey')).should == "https://www.linode.com/apiv3/utility/user.getapikey"
end
end
end