mogli 0.0.22 → 0.0.23

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.
@@ -0,0 +1,10 @@
1
+ module Mogli
2
+ class AppRequest < Model
3
+
4
+ define_properties :id, :data, :message, :created_time
5
+ hash_populating_accessor :application, "Application"
6
+ hash_populating_accessor :from, "Profile"
7
+ hash_populating_accessor :to, "Profile"
8
+
9
+ end
10
+ end
data/lib/mogli/client.rb CHANGED
@@ -131,9 +131,13 @@ module Mogli
131
131
  return nil if hash_or_array == false
132
132
  return hash_or_array if hash_or_array.nil? or hash_or_array.kind_of?(Array)
133
133
  hash_or_array = hash_or_array.parsed_response if hash_or_array.respond_to?(:parsed_response)
134
- return extract_fetching_array(hash_or_array,klass) if hash_or_array.has_key?("data")
134
+ return extract_fetching_array(hash_or_array,klass) if is_fetching_array?(hash_or_array)
135
135
  return hash_or_array
136
136
  end
137
+
138
+ def is_fetching_array?(hash)
139
+ hash.has_key?("data") and hash["data"].instance_of?(Array)
140
+ end
137
141
 
138
142
  def extract_fetching_array(hash,klass)
139
143
  f = Mogli::FetchingArray.new
@@ -163,9 +167,13 @@ module Mogli
163
167
  end
164
168
  klass_to_create.new(data,self)
165
169
  end
170
+
171
+ def capitalize_if_required(string)
172
+ string.downcase == string ? string.capitalize : string
173
+ end
166
174
 
167
175
  def constantize_string(klass)
168
- klass.is_a?(String) ? Mogli.const_get(klass.capitalize) : klass
176
+ klass.is_a?(String) ? Mogli.const_get(capitalize_if_required(klass)) : klass
169
177
  end
170
178
 
171
179
  def determine_class(klass_or_klasses,data)
data/lib/mogli/insight.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Mogli
2
2
  class Insight < Model
3
- define_properties :id, :name
4
-
3
+ define_properties :id, :name, :period
4
+ hash_populating_accessor :values, "InsightValue"
5
5
  end
6
6
  end
@@ -0,0 +1,5 @@
1
+ module Mogli
2
+ class InsightValue < Model
3
+ define_properties :value, :end_time
4
+ end
5
+ end
data/lib/mogli/user.rb CHANGED
@@ -26,6 +26,7 @@ module Mogli
26
26
  has_association :likes, "Page"
27
27
  has_association :home, "Post"
28
28
  has_association :accounts, "Page"
29
+ has_association :apprequests, "AppRequest"
29
30
 
30
31
  attr_reader :extended_permissions
31
32
 
data/lib/mogli.rb CHANGED
@@ -14,12 +14,16 @@ require "mogli/action"
14
14
  require "mogli/activity"
15
15
  require "mogli/address"
16
16
  require "mogli/album"
17
+ require "mogli/application"
18
+ require "mogli/app_request"
17
19
  require "mogli/book"
18
20
  require "mogli/checkin"
19
21
  require "mogli/comment"
20
22
  require "mogli/education"
21
23
  require "mogli/event"
22
24
  require "mogli/group"
25
+ require "mogli/insight"
26
+ require "mogli/insight_value"
23
27
  require "mogli/interest"
24
28
  require "mogli/link"
25
29
  require "mogli/location"
@@ -35,4 +39,4 @@ require "mogli/video"
35
39
  require "mogli/work"
36
40
  require "mogli/user"
37
41
  require "mogli/client"
38
- require "mogli/app_client"
42
+ require "mogli/app_client"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mogli
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 22
10
- version: 0.0.22
9
+ - 23
10
+ version: 0.0.23
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mike Mangino
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-28 00:00:00 -05:00
18
+ date: 2011-02-01 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -64,6 +64,7 @@ files:
64
64
  - lib/mogli/address.rb
65
65
  - lib/mogli/album.rb
66
66
  - lib/mogli/app_client.rb
67
+ - lib/mogli/app_request.rb
67
68
  - lib/mogli/application.rb
68
69
  - lib/mogli/authenticator.rb
69
70
  - lib/mogli/book.rb
@@ -77,6 +78,7 @@ files:
77
78
  - lib/mogli/fetching_array.rb
78
79
  - lib/mogli/group.rb
79
80
  - lib/mogli/insight.rb
81
+ - lib/mogli/insight_value.rb
80
82
  - lib/mogli/interest.rb
81
83
  - lib/mogli/link.rb
82
84
  - lib/mogli/location.rb