ob 0.0.1.1 → 0.0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 126d2e6a5cc52b3babf5ff50f440b9f24a99b972
4
- data.tar.gz: 2dd3171d84234c2b54c540c17a56b07f30d6d3ba
3
+ metadata.gz: bb59857649d8243073f973c6eb076baacb718dc2
4
+ data.tar.gz: a8a00f7b99ee698525d279cba062ca8412d15a75
5
5
  SHA512:
6
- metadata.gz: b79905db8f8a50830fcd6c3417d63377924abdc7195a7e65ffd86128beb7065d336fbeb5720fe1cb469c73e5875685e988523dd2944d4564caf202ce75748f4c
7
- data.tar.gz: bddf3c271d59f60dca5a0eac9c55418ce8e1131146475c27c657aa8145472087268e1fafe446e228aab786da5e199b45d772eb11b85b7b1b45b4365f24ba820a
6
+ metadata.gz: cd61aa2df796e881b1a55f35d50d223b6b4eb1cccc2ce3395c7e326d74e3ba151854ebd610ede56793254212a0e9d78d720d8e3ff0058b3ec38f8e65d3c273c6
7
+ data.tar.gz: deac6acc604795c5102867e305a06a340477cbf7b7b5694ace8c7bdcc6fbecedf924d121da223551a60d82833836b6ada8d3dc03c5ded95663c7319a0788a1b7
@@ -4,7 +4,7 @@ module Ob
4
4
  module ClassMethods
5
5
  def find(id)
6
6
  instance = self.new(id)
7
- response = Requestor.new.request(:get, instance.url)
7
+ response = Requestor.new.request(:get, url)
8
8
  response
9
9
  end
10
10
  end
data/lib/ob/product.rb CHANGED
@@ -2,6 +2,7 @@ module Ob
2
2
  class Product < Resource
3
3
  include Ob::Operations::Find
4
4
  include Ob::Operations::Where
5
+ include Ob::Operations::Exec
5
6
  #include RubyOb::Operationsa::Create
6
7
  #include RubyOb::Operations::Delete
7
8
  #include RubyOb::Operations::Update
data/lib/ob/requestor.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'faraday'
2
2
  require 'base64'
3
3
  require 'json'
4
+ require "rexml/document"
5
+
4
6
 
5
7
  module Ob
6
8
  class Requestor
@@ -21,7 +23,11 @@ module Ob
21
23
  def request(meth, url, params=nil)
22
24
  url = self.api_url(url)
23
25
  meth = meth.downcase
24
-
26
+ if params
27
+ if params.class != Hash
28
+ url = url + '?' + params
29
+ end
30
+ end
25
31
  begin
26
32
  conn = Faraday.new :url => url do |faraday|
27
33
  faraday.adapter Faraday.default_adapter
@@ -29,7 +35,9 @@ module Ob
29
35
  end
30
36
 
31
37
  if params
32
- conn.params = params
38
+ if params.class == Hash
39
+ conn.params = params
40
+ end
33
41
  end
34
42
  response = conn.method(meth).call
35
43
 
@@ -39,7 +47,11 @@ module Ob
39
47
  if response.status != 200
40
48
  puts "error status code is #{response.status}"
41
49
  end
42
- return JSON.parse(response.body)
50
+ if url.include? "json"
51
+ return JSON.parse response.body
52
+ else
53
+ return response.body
54
+ end
43
55
  end
44
56
  end
45
57
  end
data/lib/ob/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ob
2
- VERSION = "0.0.1.1"
2
+ VERSION = "0.0.1.2"
3
3
  end
data/lib/ob.rb CHANGED
@@ -4,6 +4,7 @@ require 'cgi'
4
4
 
5
5
  require "ob/operations/find"
6
6
  require "ob/operations/where"
7
+ require "ob/operations/exec"
7
8
 
8
9
  require "ob/ob_object"
9
10
  require "ob/resource"
@@ -36,4 +37,4 @@ module Ob
36
37
  def self.password=(password)
37
38
  @password = password
38
39
  end
39
- end
40
+ end
data/ob.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Jesus Lerma Sanchez"]
10
10
  spec.email = ["shuyojl@gmail.com"]
11
11
  spec.summary = %q{Ruby library for ob services.}
12
- spec.description = %q{This librario provides ob services operations.}
12
+ spec.description = %q{This library provides ob services operations.}
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Lerma Sanchez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2014-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,7 +58,7 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 1.8.1
61
- description: This librario provides ob services operations.
61
+ description: This library provides ob services operations.
62
62
  email:
63
63
  - shuyojl@gmail.com
64
64
  executables: []