Skip to content

Commit

Permalink
change UpYun to Upyun
Browse files Browse the repository at this point in the history
  • Loading branch information
lisposter committed Nov 17, 2014
1 parent 8459cd1 commit 5456034
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1.0
- 2.1.3


script: bundle exec rspec spec
before_install:
- gem update --system
- gem --version
- gem --version
2 changes: 1 addition & 1 deletion lib/upyun.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'upyun/rest'
require 'upyun/form'

module UpYun
module Upyun
DOMAIN = 'api.upyun.com'
ED_AUTO = "v0.#{DOMAIN}"
ED_TELECOM = "v1.#{DOMAIN}"
Expand Down
8 changes: 4 additions & 4 deletions lib/upyun/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require 'json'
require 'active_support/hash_with_indifferent_access'

module UpYun
module Upyun
class Form
VALID_PARAMS = %w(
bucket
Expand Down Expand Up @@ -40,8 +40,8 @@ def initialize(password, bucket)
end

def endpoint=(ep)
unless UpYun::ED_LIST.member?(ep)
raise ArgumentError, "Valid endpoint are #{UpYun::ED_LIST}"
unless Upyun::ED_LIST.member?(ep)
raise ArgumentError, "Valid endpoint are #{Upyun::ED_LIST}"
end

@endpoint = ep
Expand All @@ -67,7 +67,7 @@ def upload(file, opts={})
else
body = JSON.parse(res.body, symbolize_names: true)

# TODO UpYun have a small bug for the `code`,
# TODO Upyun have a small bug for the `code`,
# we have to adjust it to integer
body[:code] = body[:code].to_i
body
Expand Down
6 changes: 3 additions & 3 deletions lib/upyun/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
require 'digest/md5'
require 'uri'

module UpYun
module Upyun
class Rest
attr_accessor :endpoint

def initialize(bucket, operator, password, endpoint=UpYun::ED_AUTO)
def initialize(bucket, operator, password, endpoint=Upyun::ED_AUTO)
@bucket = bucket
@operator = operator
@password = md5(password)
@endpoint = endpoint
end

def endpoint=(ep)
raise ArgumentError, "Valid endpoint are #{UpYun::ED_LIST}" unless UpYun::ED_LIST.member?(ep)
raise ArgumentError, "Valid endpoint are #{Upyun::ED_LIST}" unless Upyun::ED_LIST.member?(ep)
@endpoint = ep
end

Expand Down
4 changes: 2 additions & 2 deletions lib/upyun/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module UpYun
VERSION = "1.0.0"
module Upyun
VERSION = "1.0.1"
end
6 changes: 3 additions & 3 deletions spec/upyun_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require File.dirname(__FILE__) + "/spec_helper"

describe "UpYun Restful API Basic testing" do
describe "Upyun Restful API Basic testing" do
before :all do
@upyun = UpYun::Rest.new("sdkfile", "tester", "grjxv2mxELR3")
@upyun = Upyun::Rest.new("sdkfile", "tester", "grjxv2mxELR3")
@file = File.expand_path("../upyun.jpg", __FILE__)
@str = "This is a binary string, not a file"
end
Expand Down Expand Up @@ -95,7 +95,7 @@

describe "Form Upload" do
before :all do
@form = UpYun::Form.new('ESxWIoMmF39nSDY7CSFUsC7s50U=', 'sdkfile')
@form = Upyun::Form.new('ESxWIoMmF39nSDY7CSFUsC7s50U=', 'sdkfile')
@file = File.expand_path("../upyun.jpg", __FILE__)
end

Expand Down
2 changes: 1 addition & 1 deletion upyun.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'upyun/version'

Gem::Specification.new do |spec|
spec.name = "upyun"
spec.version = UpYun::VERSION
spec.version = Upyun::VERSION
spec.authors = ["jsvisa"]
spec.email = ["[email protected]"]
spec.summary = "UPYUN API SDK"
Expand Down

0 comments on commit 5456034

Please sign in to comment.