putio-api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 30b3f6c19fb56def709514747a6db2ccc246b2e1
4
+ data.tar.gz: 6a641f36d0a5bd0e4a83a540917efddb51e6f819
5
+ SHA512:
6
+ metadata.gz: a4e7dd51f04c6f99c72a835567ea483a816ee6319571521b81c33cba171cfce61b63d2dcd87d673d1dff92e97e36084b8d69f907e7e30ef23efb659926ae6d64
7
+ data.tar.gz: 83c321163e1ece568c0ebf064a192a1801d6672cd091437f6883eda0d96fad2c2d5537c048c8fe708af69c1f3f0810829b982b9cb4623403f32431540163f96f
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+ gem "httparty"
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.8.0"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "bundler", "~> 1.0"
12
+ gem "jeweler", "~> 2.0.1"
13
+ gem "simplecov", ">= 0"
14
+ gem "dotenv"
15
+ end
@@ -0,0 +1,80 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.6)
5
+ builder (3.2.2)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
8
+ diff-lcs (1.1.3)
9
+ docile (1.1.3)
10
+ dotenv (0.9.0)
11
+ faraday (0.9.0)
12
+ multipart-post (>= 1.2, < 3)
13
+ git (1.2.6)
14
+ github_api (0.11.3)
15
+ addressable (~> 2.3)
16
+ descendants_tracker (~> 0.0.1)
17
+ faraday (~> 0.8, < 0.10)
18
+ hashie (>= 1.2)
19
+ multi_json (>= 1.7.5, < 2.0)
20
+ nokogiri (~> 1.6.0)
21
+ oauth2
22
+ hashie (2.0.5)
23
+ highline (1.6.21)
24
+ httparty (0.11.0)
25
+ multi_json (~> 1.0)
26
+ multi_xml (>= 0.5.2)
27
+ jeweler (2.0.1)
28
+ builder
29
+ bundler (>= 1.0)
30
+ git (>= 1.2.5)
31
+ github_api
32
+ highline (>= 1.6.15)
33
+ nokogiri (>= 1.5.10)
34
+ rake
35
+ rdoc
36
+ json (1.8.1)
37
+ jwt (0.1.11)
38
+ multi_json (>= 1.5)
39
+ mini_portile (0.5.3)
40
+ multi_json (1.9.2)
41
+ multi_xml (0.5.5)
42
+ multipart-post (2.0.0)
43
+ nokogiri (1.6.1)
44
+ mini_portile (~> 0.5.0)
45
+ oauth2 (0.9.3)
46
+ faraday (>= 0.8, < 0.10)
47
+ jwt (~> 0.1.8)
48
+ multi_json (~> 1.3)
49
+ multi_xml (~> 0.5)
50
+ rack (~> 1.2)
51
+ rack (1.5.2)
52
+ rake (10.2.2)
53
+ rdoc (3.12.2)
54
+ json (~> 1.4)
55
+ rspec (2.8.0)
56
+ rspec-core (~> 2.8.0)
57
+ rspec-expectations (~> 2.8.0)
58
+ rspec-mocks (~> 2.8.0)
59
+ rspec-core (2.8.0)
60
+ rspec-expectations (2.8.0)
61
+ diff-lcs (~> 1.1.2)
62
+ rspec-mocks (2.8.0)
63
+ simplecov (0.8.2)
64
+ docile (~> 1.1.0)
65
+ multi_json
66
+ simplecov-html (~> 0.8.0)
67
+ simplecov-html (0.8.0)
68
+ thread_safe (0.3.2)
69
+
70
+ PLATFORMS
71
+ ruby
72
+
73
+ DEPENDENCIES
74
+ bundler (~> 1.0)
75
+ dotenv
76
+ httparty
77
+ jeweler (~> 2.0.1)
78
+ rdoc (~> 3.12)
79
+ rspec (~> 2.8.0)
80
+ simplecov
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Noah Pryor
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ = putio
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to putio
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2014 Noah Pryor. See LICENSE.txt for
18
+ further details.
19
+
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "putio-api"
18
+ gem.homepage = "http://github.com/noahpryor/putio"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Put.io API wrapper}
21
+ gem.description = "Provides methods for interacting with the Put io web API"
22
+ gem.email = "noah@noahpryor.com"
23
+ gem.authors = ["Noah Pryor"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ desc "Code coverage detail"
35
+ task :simplecov do
36
+ ENV['COVERAGE'] = "true"
37
+ Rake::Task['spec'].execute
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rdoc/task'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "putio #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,19 @@
1
+ require 'putio/configuration'
2
+ require 'putio/client'
3
+ module Putio
4
+ class << self
5
+ attr_writer :configuration
6
+ end
7
+
8
+ def self.configuration
9
+ @configuration ||= Configuration.new
10
+ end
11
+
12
+ def self.reset
13
+ @configuration = Configuration.new
14
+ end
15
+
16
+ def self.configure
17
+ yield(configuration)
18
+ end
19
+ end
@@ -0,0 +1,27 @@
1
+ require 'httparty'
2
+ module Putio
3
+ class Client
4
+ include HTTParty
5
+ base_uri "https://api.put.io/v2"
6
+ def initialize(user_token)
7
+ @auth = {:query =>{:oauth_token=> user_token},:headers => {"Accept:" => "application/json"}}
8
+ @options = {}
9
+ end
10
+
11
+ def files
12
+ get_endpoint("/files/list")["files"]
13
+ end
14
+ def search(options)
15
+ end
16
+
17
+ def get_endpoint(endpoint,options={})
18
+ options.merge! @auth
19
+ response = self.class.get(endpoint,options).parsed_response
20
+ if response["status"] == "ERROR"
21
+ raise AuthError
22
+ else
23
+ return response
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ module Putio
2
+ class Configuration
3
+ attr_accessor :application_secret, :client_id, :base_url
4
+
5
+ def initialize
6
+ @application_secret = nil
7
+ @client_id = nil
8
+ @base_url = "https://api.put.io/v2/"
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,72 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "putio-api"
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Noah Pryor"]
12
+ s.date = "2014-04-06"
13
+ s.description = "Provides methods for interacting with the Put io web API"
14
+ s.email = "noah@noahpryor.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "lib/putio.rb",
29
+ "lib/putio/client.rb",
30
+ "lib/putio/configuration.rb",
31
+ "putio-api.gemspec",
32
+ "spec/client_spec.rb",
33
+ "spec/configuration_spec.rb",
34
+ "spec/spec_helper.rb"
35
+ ]
36
+ s.homepage = "http://github.com/noahpryor/putio"
37
+ s.licenses = ["MIT"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = "2.0.14"
40
+ s.summary = "Put.io API wrapper"
41
+
42
+ if s.respond_to? :specification_version then
43
+ s.specification_version = 4
44
+
45
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
47
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
48
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
49
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
50
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
51
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
52
+ s.add_development_dependency(%q<dotenv>, [">= 0"])
53
+ else
54
+ s.add_dependency(%q<httparty>, [">= 0"])
55
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
56
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
57
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
58
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
59
+ s.add_dependency(%q<simplecov>, [">= 0"])
60
+ s.add_dependency(%q<dotenv>, [">= 0"])
61
+ end
62
+ else
63
+ s.add_dependency(%q<httparty>, [">= 0"])
64
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
65
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
66
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
67
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
68
+ s.add_dependency(%q<simplecov>, [">= 0"])
69
+ s.add_dependency(%q<dotenv>, [">= 0"])
70
+ end
71
+ end
72
+
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Putio" do
4
+ describe "client" do
5
+ before do
6
+ Putio.configure do |config|
7
+ config.application_secret = ENV["PUTIO_APPLICATION_SECRET"]
8
+ config.client_id = ENV["PUTIO_CLIENT_ID"]
9
+ end
10
+ end
11
+
12
+ it "should connect with a valid auth token" do
13
+ user_token = ENV["PUTIO_OAUTH_TOKEN"]
14
+ client = Putio::Client.new(user_token)
15
+ client.files.class.should eq(Array)
16
+ end
17
+
18
+ it "should not connect with a valid auth token" do
19
+ user_token = "FOO"
20
+ client = Putio::Client.new(user_token)
21
+ expect { client.files }.to raise_error
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,15 @@
1
+ require "spec_helper"
2
+
3
+ module Putio
4
+ describe Configuration do
5
+ describe "application_secret and client_id" do
6
+ it "can be set" do
7
+ config = Configuration.new
8
+ config.application_secret = "test"
9
+ config.client_id = 1
10
+ config.client_id.should eq 1
11
+ config.application_secret.should eq "test"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,30 @@
1
+ require 'simplecov'
2
+ require 'dotenv'
3
+ Dotenv.load
4
+ module SimpleCov::Configuration
5
+ def clean_filters
6
+ @filters = []
7
+ end
8
+ end
9
+
10
+ SimpleCov.configure do
11
+ clean_filters
12
+ load_adapter 'test_frameworks'
13
+ end
14
+
15
+ ENV["COVERAGE"] && SimpleCov.start do
16
+ add_filter "/.rvm/"
17
+ end
18
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
19
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
20
+
21
+ require 'rspec'
22
+ require 'putio'
23
+
24
+ # Requires supporting files with custom matchers and macros, etc,
25
+ # in ./support/ and its subdirectories.
26
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
27
+
28
+ RSpec.configure do |config|
29
+
30
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: putio-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Noah Pryor
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 2.8.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 2.8.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: jeweler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: dotenv
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Provides methods for interacting with the Put io web API
112
+ email: noah@noahpryor.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files:
116
+ - LICENSE.txt
117
+ - README.rdoc
118
+ files:
119
+ - .document
120
+ - .rspec
121
+ - Gemfile
122
+ - Gemfile.lock
123
+ - LICENSE.txt
124
+ - README.rdoc
125
+ - Rakefile
126
+ - VERSION
127
+ - lib/putio.rb
128
+ - lib/putio/client.rb
129
+ - lib/putio/configuration.rb
130
+ - putio-api.gemspec
131
+ - spec/client_spec.rb
132
+ - spec/configuration_spec.rb
133
+ - spec/spec_helper.rb
134
+ homepage: http://github.com/noahpryor/putio
135
+ licenses:
136
+ - MIT
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.0.14
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Put.io API wrapper
158
+ test_files: []