iremix-ruby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -16,5 +16,3 @@ tmp
16
16
  .yardoc
17
17
  _yardoc
18
18
  doc/
19
-
20
- spec/support/iremix_config.rb
data/.rspec CHANGED
@@ -1,2 +1 @@
1
1
  --color
2
- --format progress
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use --create 1.9.3@iremix-ruby
1
+ rvm use --create 1.9.3@iremix
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ notifications:
5
+ email:
6
+ on_failure: change
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in iremix-ruby.gemspec
4
4
  gemspec
5
+
6
+ gem 'rake', :group => :test
data/Gemfile.lock CHANGED
@@ -2,21 +2,12 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  iremix-ruby (0.0.1)
5
- active_support
6
- json
7
- typhoeus
8
5
 
9
6
  GEM
10
7
  remote: https://rubygems.org/
11
8
  specs:
12
- active_support (3.0.0)
13
- activesupport (= 3.0.0)
14
- activesupport (3.0.0)
15
- addressable (2.2.7)
16
- crack (0.3.1)
17
9
  diff-lcs (1.1.3)
18
- json (1.6.6)
19
- mime-types (1.18)
10
+ rake (0.9.2.2)
20
11
  rspec (2.9.0)
21
12
  rspec-core (~> 2.9.0)
22
13
  rspec-expectations (~> 2.9.0)
@@ -25,18 +16,11 @@ GEM
25
16
  rspec-expectations (2.9.1)
26
17
  diff-lcs (~> 1.1.3)
27
18
  rspec-mocks (2.9.0)
28
- typhoeus (0.3.3)
29
- mime-types
30
- vcr (2.1.1)
31
- webmock (1.8.6)
32
- addressable (>= 2.2.7)
33
- crack (>= 0.1.7)
34
19
 
35
20
  PLATFORMS
36
21
  ruby
37
22
 
38
23
  DEPENDENCIES
39
24
  iremix-ruby!
25
+ rake
40
26
  rspec
41
- vcr
42
- webmock
data/README.md CHANGED
@@ -1,35 +1,31 @@
1
- iremix-ruby
2
- ===========
1
+ # Iremix::Ruby
3
2
 
4
- Installation
5
- ============
3
+ [![Build Status](https://secure.travis-ci.org/neotericdesign/iremix-ruby.png?branch=master)](http://travis-ci.org/neotericdesign/iremix-ruby)
6
4
 
7
- ```ruby
8
- # in a bundler Gemfile
9
- gem 'iremix-ruby', '~> 0.0.1'
10
- ```
5
+ A thin ruby client for the iRemix API
11
6
 
12
- ```
13
- # or manually
14
- gem install iremix-ruby
15
- ```
7
+ ## Installation
16
8
 
17
- Testing
18
- =======
9
+ Add this line to your application's Gemfile:
19
10
 
11
+ gem 'iremix-ruby'
20
12
 
21
- ```
22
- # Clone the project, change into the project's directory
23
- # If you have RVM enabled, choose (y)es to trust the .rvmrc
24
- git clone git://github.com/neotericdesign/iremix-ruby.git
25
- cd iremix-ruby
13
+ And then execute:
26
14
 
27
- # Generate the test config file
28
- # Fill in your oAuth key and secret in the resulting spec/support/iremix_config.rb
29
- rake test:config
15
+ $ bundle
30
16
 
31
- # Install bundler, bundle the gem's dependencies, and run the test suite
32
- gem install bundler
33
- bundle
34
- rspec
35
- ```
17
+ Or install it yourself as:
18
+
19
+ $ gem install iremix-ruby
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,29 +1,7 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
3
4
 
4
- namespace :test do
5
- desc "Install an empty config file for testing iremix"
6
- task :config do
7
- unless File.exists?('spec/support/iremix_config.rb')
8
- system "mkdir spec/support" unless File.directory?('spec/support')
5
+ RSpec::Core::RakeTask.new(:spec)
9
6
 
10
- file = File.open('spec/support/iremix_config.rb', 'w') do |f|
11
- f.write <<-CODE
12
- require 'iremix'
13
-
14
- HYDRA = Typhoeus::Hydra.new
15
- key = 'fill in your key'
16
- secret = 'fill in your secret'
17
- protocol = 'http://'
18
- host = 'dev.iremix.me'
19
-
20
- Iremix::Config.hydra = HYDRA
21
- Iremix::Config.consumer_key = key
22
- Iremix::Config.consumer_secret = secret
23
- Iremix::Config.protocol = protocol
24
- Iremix::Config.host = host
25
- CODE
26
- end
27
- end
28
- end
29
- end
7
+ task :default => :spec
data/iremix-ruby.gemspec CHANGED
@@ -4,9 +4,9 @@ require File.expand_path('../lib/iremix/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = %w(Joe Sak, Neoteric Design)
6
6
  gem.email = %w(joe@neotericdesign.com)
7
- gem.description = %q{Not yet}
8
- gem.summary = %q{Not yet}
9
- gem.homepage = ""
7
+ gem.description = %q{A ruby wrapper for the iRemix API}
8
+ gem.summary = %q{What the desc. said}
9
+ gem.homepage = "http://github.com/neotericdesign/iremix-ruby"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -15,11 +15,5 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Iremix::Ruby::VERSION
17
17
 
18
- gem.add_dependency 'active_support'
19
- gem.add_dependency 'typhoeus'
20
- gem.add_dependency 'json'
21
-
22
18
  gem.add_development_dependency 'rspec'
23
- gem.add_development_dependency 'vcr'
24
- gem.add_development_dependency 'webmock'
25
19
  end
data/lib/iremix.rb CHANGED
@@ -1,4 +1,21 @@
1
- require "iremix/all"
1
+ require "iremix/version"
2
+ require 'iremix/config'
2
3
 
3
4
  module Iremix
5
+ class << self
6
+ attr_accessor :config
7
+
8
+ def callback_url
9
+ config.callback_url
10
+ end
11
+
12
+ def authorize_url(client)
13
+ client.auth_code.authorize_url(:redirect_url => callback_url)
14
+ end
15
+
16
+ private
17
+ def config
18
+ @config ||= Iremix::Config
19
+ end
20
+ end
4
21
  end
data/lib/iremix/config.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  module Iremix
2
2
  class Config
3
3
  class << self
4
- attr_accessor :hydra, :consumer_key, :consumer_secret,
5
- :protocol, :host
4
+ attr_accessor :callback_url
6
5
  end
7
6
  end
8
7
  end
@@ -0,0 +1,10 @@
1
+ module Iremix
2
+ class Token
3
+ attr_accessor :access_token
4
+
5
+ def initialize(auth_code, client)
6
+ @access_token = client.auth_code.get_token(auth_code,
7
+ :redirect_url => Iremix.callback_url)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ module Iremix
2
+ class User
3
+ class << self
4
+ def current(token)
5
+ response = token.get('/api/v1/people/current.json',
6
+ :params => { :access_token => token.access_token })
7
+
8
+ response.parsed
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  module Iremix
2
2
  module Ruby
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -0,0 +1,18 @@
1
+ require 'iremix'
2
+
3
+ describe Iremix do
4
+ describe ".callback_url" do
5
+ it "returns the callback url" do
6
+ Iremix::Config.stub(:callback_url) { 'url' }
7
+ Iremix.callback_url.should == 'url'
8
+ end
9
+ end
10
+
11
+ describe ".authorize_url" do
12
+ it "returns the url" do
13
+ client = stub(:client)
14
+ client.stub_chain(:auth_code, :authorize_url) { 'a url' }
15
+ Iremix.authorize_url(client).should == 'a url'
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+ require 'iremix/token'
2
+
3
+ module Iremix
4
+ describe Token do
5
+ describe "#access_token" do
6
+ let(:access_token) { stub(:access_token) }
7
+ let(:client) { stub(:client) }
8
+
9
+ before :each do
10
+ Iremix.stub(:callback_url => 'url')
11
+ end
12
+
13
+ it "returns a token from the client" do
14
+ client.stub(:auth_code) { client }
15
+ client.stub(:get_token)
16
+ .with('123abc', :redirect_url => 'url') { access_token }
17
+
18
+ token = Token.new('123abc', client)
19
+
20
+ token.access_token.should == access_token
21
+ end
22
+ end
23
+ end
24
+ end
25
+
@@ -0,0 +1,20 @@
1
+ require 'ostruct'
2
+ require 'iremix/user'
3
+
4
+ module Iremix
5
+ describe User do
6
+ describe ".current" do
7
+ it "returns the parsed user" do
8
+ token = OpenStruct.new(:access_token => '123abc')
9
+ response = OpenStruct.new(:parsed => 'user_json_parsed')
10
+
11
+ token.should_receive(:get)
12
+ .with('/api/v1/people/current.json',
13
+ :params => { :access_token => '123abc' })
14
+ .and_return(response)
15
+
16
+ Iremix::User.current(token).should == 'user_json_parsed'
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iremix-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,66 +12,11 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-05-01 00:00:00.000000000 Z
15
+ date: 2012-05-04 00:00:00.000000000 Z
16
16
  dependencies:
17
- - !ruby/object:Gem::Dependency
18
- name: active_support
19
- requirement: &2162950500 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ! '>='
23
- - !ruby/object:Gem::Version
24
- version: '0'
25
- type: :runtime
26
- prerelease: false
27
- version_requirements: *2162950500
28
- - !ruby/object:Gem::Dependency
29
- name: typhoeus
30
- requirement: &2162966440 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - ! '>='
34
- - !ruby/object:Gem::Version
35
- version: '0'
36
- type: :runtime
37
- prerelease: false
38
- version_requirements: *2162966440
39
- - !ruby/object:Gem::Dependency
40
- name: json
41
- requirement: &2162966020 !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: *2162966020
50
17
  - !ruby/object:Gem::Dependency
51
18
  name: rspec
52
- requirement: &2162965600 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
55
- - - ! '>='
56
- - !ruby/object:Gem::Version
57
- version: '0'
58
- type: :development
59
- prerelease: false
60
- version_requirements: *2162965600
61
- - !ruby/object:Gem::Dependency
62
- name: vcr
63
- requirement: &2162965180 !ruby/object:Gem::Requirement
64
- none: false
65
- requirements:
66
- - - ! '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- type: :development
70
- prerelease: false
71
- version_requirements: *2162965180
72
- - !ruby/object:Gem::Dependency
73
- name: webmock
74
- requirement: &2162964760 !ruby/object:Gem::Requirement
19
+ requirement: &70190921794940 !ruby/object:Gem::Requirement
75
20
  none: false
76
21
  requirements:
77
22
  - - ! '>='
@@ -79,8 +24,8 @@ dependencies:
79
24
  version: '0'
80
25
  type: :development
81
26
  prerelease: false
82
- version_requirements: *2162964760
83
- description: Not yet
27
+ version_requirements: *70190921794940
28
+ description: A ruby wrapper for the iRemix API
84
29
  email:
85
30
  - joe@neotericdesign.com
86
31
  executables: []
@@ -90,24 +35,22 @@ files:
90
35
  - .gitignore
91
36
  - .rspec
92
37
  - .rvmrc
38
+ - .travis.yml
93
39
  - Gemfile
94
40
  - Gemfile.lock
95
41
  - LICENSE
96
42
  - README.md
97
43
  - Rakefile
98
- - fixtures/cassettes/initialize_a_new_client.yml
99
44
  - iremix-ruby.gemspec
100
45
  - lib/iremix.rb
101
- - lib/iremix/all.rb
102
- - lib/iremix/client.rb
103
46
  - lib/iremix/config.rb
47
+ - lib/iremix/token.rb
48
+ - lib/iremix/user.rb
104
49
  - lib/iremix/version.rb
105
- - lib/iremix/video.rb
106
- - spec/iremix/client_spec.rb
107
- - spec/iremix/video_spec.rb
108
- - spec/spec_helper.rb
109
- - spec/vcr_helper.rb
110
- homepage: ''
50
+ - spec/iremix/iremix_spec.rb
51
+ - spec/iremix/token_spec.rb
52
+ - spec/iremix/user_spec.rb
53
+ homepage: http://github.com/neotericdesign/iremix-ruby
111
54
  licenses: []
112
55
  post_install_message:
113
56
  rdoc_options: []
@@ -127,12 +70,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
70
  version: '0'
128
71
  requirements: []
129
72
  rubyforge_project:
130
- rubygems_version: 1.8.16
73
+ rubygems_version: 1.8.15
131
74
  signing_key:
132
75
  specification_version: 3
133
- summary: Not yet
76
+ summary: What the desc. said
134
77
  test_files:
135
- - spec/iremix/client_spec.rb
136
- - spec/iremix/video_spec.rb
137
- - spec/spec_helper.rb
138
- - spec/vcr_helper.rb
78
+ - spec/iremix/iremix_spec.rb
79
+ - spec/iremix/token_spec.rb
80
+ - spec/iremix/user_spec.rb
@@ -1,70 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://dev.iremix.me/oauth/authorize
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 302
13
- message: !binary |-
14
- TW92ZWQgVGVtcG9yYXJpbHk=
15
- headers:
16
- !binary "U2VydmVy":
17
- - !binary |-
18
- bmdpbng=
19
- !binary "RGF0ZQ==":
20
- - !binary |-
21
- VGh1LCAyNiBBcHIgMjAxMiAyMjozMToxNCBHTVQ=
22
- !binary "Q29udGVudC1UeXBl":
23
- - !binary |-
24
- dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04
25
- !binary "Q29ubmVjdGlvbg==":
26
- - !binary |-
27
- a2VlcC1hbGl2ZQ==
28
- !binary "TG9jYXRpb24=":
29
- - !binary |-
30
- aHR0cDovL2Rldi5pcmVtaXgubWUvdXNlcnMvc2lnbl9pbg==
31
- !binary "Q2FjaGUtQ29udHJvbA==":
32
- - !binary |-
33
- bm8tY2FjaGU=
34
- !binary "WC1VYS1Db21wYXRpYmxl":
35
- - !binary |-
36
- SUU9RWRnZSxjaHJvbWU9MQ==
37
- !binary "U2V0LUNvb2tpZQ==":
38
- - !binary |-
39
- X3JlbWl4X3JhaWxzM19zZXNzaW9uPUJBaDdDRWtpRDNObGMzTnBiMjVmYVdR
40
- R09nWkZSaUlsWldRM1ltWTBPREU1TVRSa1pHUXlNVEpqTVdFNVptTmtNamMx
41
- T1RBek1UZEpJaE4xYzJWeVgzSmxkSFZ5Ymw5MGJ3WTdBRVlpRlM5dllYVjBh
42
- QzloZFhSb2IzSnBlbVZKSWdwbWJHRnphQVk3QUVaSlF6b2xRV04wYVc5dVJH
43
- bHpjR0YwWTJnNk9rWnNZWE5vT2pwR2JHRnphRWhoYzJoN0Jqb0tZV3hsY25S
44
- SklnWWdCanNBVkFZNkNrQjFjMlZrYnpvSVUyVjBCam9LUUdoaGMyaDdBQSUz
45
- RCUzRC0tNmUyYmQ2NTRjMDBjOTFkYTU1MzhhMzkwM2I3MzllNjcyZGQ2NDA5
46
- NjsgcGF0aD0vOyBIdHRwT25seQ==
47
- !binary "WC1SdW50aW1l":
48
- - !binary |-
49
- MC4wNTA4ODI=
50
- !binary "Q29udGVudC1MZW5ndGg=":
51
- - !binary |-
52
- MTAw
53
- !binary "WC1WYXJuaXNo":
54
- - !binary |-
55
- ODg4NDMyNDEw
56
- !binary "QWdl":
57
- - !binary |-
58
- MA==
59
- !binary "Vmlh":
60
- - !binary |-
61
- MS4xIHZhcm5pc2g=
62
- body:
63
- encoding: ASCII-8BIT
64
- string: !binary |-
65
- PGh0bWw+PGJvZHk+WW91IGFyZSBiZWluZyA8YSBocmVmPSJodHRwOi8vZGV2
66
- LmlyZW1peC5tZS91c2Vycy9zaWduX2luIj5yZWRpcmVjdGVkPC9hPi48L2Jv
67
- ZHk+PC9odG1sPg==
68
- http_version:
69
- recorded_at: Thu, 26 Apr 2012 22:31:14 GMT
70
- recorded_with: VCR 2.1.1
data/lib/iremix/all.rb DELETED
@@ -1,3 +0,0 @@
1
- require "iremix/version"
2
- require "iremix/config"
3
- require "iremix/client"
data/lib/iremix/client.rb DELETED
@@ -1,13 +0,0 @@
1
- require 'typhoeus'
2
- require 'json'
3
-
4
- module Iremix
5
- class Client
6
- attr_accessor :authorized
7
- alias :authorized? :authorized
8
-
9
- def initialize
10
- @authorized = false
11
- end
12
- end
13
- end
data/lib/iremix/video.rb DELETED
@@ -1,14 +0,0 @@
1
- module Iremix
2
- class Video
3
-
4
- class << self
5
- def all
6
- request = Typhoeus::Request.new(get_all_url)
7
- Iremix::Config.hydra.queue(request)
8
- end
9
-
10
- def get_all_url
11
- end
12
- end
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- require './spec/support/iremix_config'
2
- require 'iremix/client'
3
-
4
- module Iremix
5
- describe Client do
6
- it "is not authorized" do
7
- client = Client.new
8
- client.should_not be_authorized
9
- end
10
- end
11
- end
@@ -1,18 +0,0 @@
1
- require './spec/support/iremix_config'
2
- require 'iremix/video'
3
-
4
- module Iremix
5
- describe Video do
6
- describe ".all" do
7
- it "queues a request for videos" do
8
- request = stub(:request)
9
- Typhoeus::Request.should_receive(:new)
10
- .with(Video.get_all_url)
11
- .and_return(request)
12
- Iremix::Config.hydra.should_receive(:queue)
13
- .with(request)
14
- Video.all
15
- end
16
- end
17
- end
18
- end
data/spec/spec_helper.rb DELETED
@@ -1,11 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
- # loaded once.
5
- #
6
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
- RSpec.configure do |config|
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
- config.run_all_when_everything_filtered = true
10
- config.filter_run :focus
11
- end
data/spec/vcr_helper.rb DELETED
@@ -1,6 +0,0 @@
1
- VCR.configure do |config|
2
- config.cassette_library_dir = "fixtures/cassettes"
3
- config.hook_into :webmock
4
- config.filter_sensitive_data("<CONSUMER KEY>") { Iremix::Client.config.consumer_key }
5
- config.filter_sensitive_data("<CONSUMER SECRET>") { Iremix::Client.config.consumer_key }
6
- end